-
-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Middleware not added to chain? #2
Comments
I updated to 2.3.2 and I still have the same problem... Any idea what might be wrong? It's kind of a show-stopper for me unfortunately. Thanks! |
Real sorry you are having that problem still! Uniqueness should have been added automagically. Any chance you could share the project with us or if that isn't possible could you try and replicate the problem in a fresh repo? |
Thanks for caring. I put together a small project that reproduces the problem. Just run bundle and rake spec. https://dl.dropbox.com/u/132165/unique-job-bug.zip I also ran into another issue I haven't seen before, but I wonder if it's a Sidekiq but rather than a unique-jobs bug. I marked that test as "pending". |
It's obviously getting late, I started running tests instead of specs. I'll be back |
Are you sure that middleware is executed in the tests? I'm not sure it is. |
FYI I just realized that in my spec file, I try to queue a whole activerecord object. The problem still persists when I replace the object with a simple string such as 'abc'.
|
Yup mike is right, to test this you would need to test against a real redis since the sidekiq/test doesn't take into consideration any middleware, it just pushes everything to jobs array without hesitation. before {
Sidekiq.redis = REDIS
Sidekiq.redis {|c| c.flushdb }
}
it "does not store duplicate jobs" do
3.times {
Sidekiq::Client.push('class' => NotificationPushWorker, 'queue' => 'notification_push', 'args' => notification.id)
}
Sidekiq.redis { |c| c.llen('queue:notification_push') }.should eql 1
end Really not ideal agreeably, I'll see if I can add some sort of hook for testing this in a client app. |
Ah! So basically, you're saying that my tests fail but that in real life, it should just work? I guess I'll test with the workaround for now. Thanks! |
I can confirm via playing around on my own apps that the middleware does work and get executed. My jobs are unique, but I agree that not seeing it show up in the client middleware stack was confusing. I'm just glad this is working. |
Awesome :) |
I added the gem to my Gemfile and I couldn't get UniqueJobs to work. I pry'ed my code and it looks like the middleware is not automatically inserted in the chain.
I tried adding it in an initializer as well as manually in a Pry session but to no avail. Oddly enough, the Client middleware is added. Any idea what might be going on? Here's some code:
Thanks!
The text was updated successfully, but these errors were encountered: