I'm running into an issue where using the Sidekiq::Worker.set method (see here) to set worker options seems to prevent sidekiq-unique-jobs from enforcing uniqueness.
Here's an example.
class HardWorker
include Sidekiq::Worker
sidekiq_options retry: false, unique: :until_and_while_executing
def perform(name, count); end
end
Calling HardWorker.perform_async('foo', 1) multiple times is successful and only 1 job is enqueued.
Sometimes though, I want this worker on a different queue, so we call HardWorker.set(queue: :critical).perform_async('foo', 1). Calling this multiple times adds and additional job to the queue for each call. Looking at HardWorker.jobs I see multiple identical jobs, same args, same unique_digest. I believe uniqueness should still be enforced in this case.
The issue occurs with sidekiq 5.x and any version of sidekiq-unique-jobs (tested 4.0.18 and 5.0.10), does not occur when using sidekiq 4.x.
I can create a simple project with a failing spec if it helps. If you have any questions or need more clarifications, let me know.
Thanks.
I'm running into an issue where using the
Sidekiq::Worker.setmethod (see here) to set worker options seems to preventsidekiq-unique-jobsfrom enforcing uniqueness.Here's an example.
Calling
HardWorker.perform_async('foo', 1)multiple times is successful and only 1 job is enqueued.Sometimes though, I want this worker on a different queue, so we call
HardWorker.set(queue: :critical).perform_async('foo', 1). Calling this multiple times adds and additional job to the queue for each call. Looking atHardWorker.jobsI see multiple identical jobs, same args, same unique_digest. I believe uniqueness should still be enforced in this case.The issue occurs with
sidekiq5.x and any version ofsidekiq-unique-jobs(tested 4.0.18 and 5.0.10), does not occur when usingsidekiq4.x.I can create a simple project with a failing spec if it helps. If you have any questions or need more clarifications, let me know.
Thanks.