Writing · 2023 · 1 min
Using Sidekiq Iteration and Unique Jobs
This will remove the sidekiq iteration hash from the arguments, so the sidekiq job will appear unique to unique jobs.
Couldn’t find this online so here is a quick fix.
include Sidekiq::Job
include SidekiqIteration::Iteration
sidekiq_options queue: :default, lock: :until_and_while_executing, on_conflict: :reject
if args.last.is_a?(Hash) && args.last.key?("sidekiq_iteration")
args.take(args.length - 1)
else
args
end
end
# ...
Refs
https://github.com/mhenrixon/sidekiq-unique-jobs https://github.com/fatkodima/sidekiq-iteration
Comments
No comments yet. Be the first.