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

Unique key inconsistency between server and client #48

Closed
elhu opened this issue Oct 6, 2014 · 4 comments
Closed

Unique key inconsistency between server and client #48

elhu opened this issue Oct 6, 2014 · 4 comments

Comments

@elhu
Copy link

elhu commented Oct 6, 2014

Hi,

I encountered a problem today while trying to use this gem, when using custom uniqueness parameters, I found that the key added to Redis to enforce uniqueness isn't the same as the key later deleted by the server.
In my case, this means that once my first job is pushed to the Sidekiq queue, no more jobs can be added even after the first one is processed, since the lock key is still present in Redis.

It might be because of another middleware misbehaving, but I believe sidekiq-unique-jobs should be able to avoid this kind of deadlock.
After looking a bit at the code, I saw that the name of the key used to enforce uniqueness is added to the job's payload. Is there a reason why this key isn't then used by the server to perform the unlock, instead of trying to recompute it?

I'd be happy to provide a pull-request if you want.

Thanks a lot in advance !

@mhenrixon
Copy link
Owner

The idea was to lock jobs with a key that is potentially different from the job key but I'd be real interested to see what you could come up. This is a problem right now so if you have any ideas please do share.

@mhenrixon
Copy link
Owner

15c2142 might help with that?

@elhu
Copy link
Author

elhu commented Oct 15, 2014

I'm going with elhu@7b09226 for now. It's working in my use-case, and I have yet to notice any drawback.

I'd be happy to send a PR if you think it's a good solution for the problem at hand!

@mhenrixon
Copy link
Owner

I believe this was fixed during the weekend.

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

No branches or pull requests

2 participants