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

set(unique_for: ...) not working with ActiveJob #6296

Closed
lorrin opened this issue May 16, 2024 · 3 comments
Closed

set(unique_for: ...) not working with ActiveJob #6296

lorrin opened this issue May 16, 2024 · 3 comments

Comments

@lorrin
Copy link

lorrin commented May 16, 2024

Ruby version: 3.1.4p223
Rails version: 6.1.7
Sidekiq / Pro / Enterprise version(s): sidekiq= 7.1.4 / pro 7.1.4 / ent 7.1.2

https://github.com/sidekiq/sidekiq/wiki/Ent-Unique-Jobs#bypassing-or-dynamically-setting-uniqueness describes using .set(unique_for: ...) to dynamically set uniqueness on a specific job. This isn't working for me through ActiveJob. Is it supposed to work in ActiveJob? Would I set it the same way?

For context, I have a job that is intentionally unique, but which sometimes wants to re-enqueue a future execution of itself using e.g. MyJob.set(wait: delay, unique_for: false).perform_later(...). Happy to have other suggestions.

If you are using an old version, have you checked the changelogs to see if your issue has been fixed in a later version?

Checked, didn't spot anything.

@mperham
Copy link
Collaborator

mperham commented May 16, 2024

It's possible the problem is using a Symbol instead of a String. Sidekiq stringifies everything but I don't know that ActiveJob does. Try "unique_for" => false instead.

@lorrin
Copy link
Author

lorrin commented May 16, 2024

Hmm, no luck with MyJob.set("unique_for" => false).perform_later(...). It still gives me Skipping enqueue for MyJob, not unique

@mperham
Copy link
Collaborator

mperham commented May 17, 2024

I can't explain what's wrong. You'll need to step thru it with a debugger.

@mperham mperham closed this as completed Jun 10, 2024
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