Closed holstvoogd closed 7 years ago
cool, looks like a good catch. any chance we can get a test that demonstrates the issue as you describe it? The test you have already is a good one (confirming the equality of the original job spec), but doesn't confirm the JID isn't re-used (or even just maintained in memory from being the same object). thanks!
I've added a test on the scheduler that covers the behaviour a bit better!
perfect, thanks!
Sidekiq::Client adds the JID it generates to the spec, since the spec is kept in memory by the scheduler, the next time the job is enqueued the spec includes this JID and Sidekiq will use that instead of generating a new one.
This can result in multiple jobs with the same id either enqueued or active. This breaks the locking mechanism of sidekiq-unique-jobs and might have some other unwanted effects.