Skip to content
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

Your testing lib is broken and don't permit to test uniqueness of jobs #232

Merged
merged 1 commit into from
Jul 6, 2017
Merged

Your testing lib is broken and don't permit to test uniqueness of jobs #232

merged 1 commit into from
Jul 6, 2017

Conversation

keysen
Copy link
Contributor

@keysen keysen commented Jun 20, 2017

Hello,

I discovered an issue when migrating from 3.0.11 to 4.0.18.

Inside this file:

lib/sidekiq_unique_jobs/testing.rb

You decided to do that:

          _server.call(worker_class.new, item, queue, redis_pool) do
            call_real(worker_class, item, queue, redis_pool) do
               yield
             end
           end

Instead of that (my solution):

          call_real(worker_class, item, queue, redis_pool) do
            _server.call(worker_class.new, item, queue, redis_pool) do
              yield
            end
          end

It does not make sense because it means in your version you run the server first (the server is the one who performs the job), then you run the client (client pushs the jobs)

It means in details, at first you release the lock then in the client you acquire a lock, but NO, at first you should acquire a lock... and then after processing the job the lock should be released by the server?! So basically when you want to execute complicated specs where the uniqueness is important we faced of an issue because the lock just don't work. I wasted many days to understand why.

I left some puts in the PR to help you to understand the issue :). But this should of course be removed.

Otherwise good job for the 4.0.18 it's much better than 3.0.11 👍

Edit: sorry for the previous PR (#231) I was unable to provide you a valid PR without comparing with master and my previous PR was relying on a tag version, so I recreated a new one.

@mhenrixon mhenrixon merged commit 9bff27f into mhenrixon:master Jul 6, 2017
@mhenrixon
Copy link
Owner

Thank you!

@keysen
Copy link
Contributor Author

keysen commented Jul 6, 2017

Awesome thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants