Skip to content

until_and_while_executing + sidekiq retry mechanism #395

@jchatel

Description

@jchatel

This is more of a question that I didn't see addressed in the doc.

By default, Sidekiq will retry a job that fails with incremental delay.

I'm using this config:

sidekiq_options lock: :until_and_while_executing
, lock_expiration: 60*60
, unique_across_queues: true
, unique_args: ->(args) { [ args.first ] }
, on_conflict: :reject

...to ensure:

only 1 job is enqueued at max (to prevent accumulations as I add this job whenever an action happens)
and only 1 job is being executed at max (as I need to process a sendqueue 1 item at a time with delay between them).

How does until_and_while_executing works with the retry of Sidekiq?

Should I assume that retry is just another queue of SideKiq?

If a job fails and goes to the retry queue of Sidekiq, does the lock apply? And so I can't push another similar job to a normal queue? Does that mean that would be the case for max 1 hour because of the lock expiration? So I may have to wait 1 hour (lock_expiration) before a job is processed (as the retry, with exponential retry may end up being 24hour).

If I remove the "unique_across_queues: true" argument, does that mean that I will potentially have plenty of similar jobs in the retry queue of sidekiq, but I asusme only 1 will be executed at the same time (or will execution of a retry bypass the lock?)

Are those assumptions correct?

Thanks

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions