Open ixti opened 11 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
02704ab
) 98.92% compared to head (21136ba
) 98.92%. Report is 7 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
c.cooldown_period = lambda do |unit_of_work|
I'm not sure about the unit_of_work
in the interface. Maybe a queue name would be enough? I'm just thinking about how it can be done in a bit more explicit fashion.
I'm not sure about the
unit_of_work
in the interface. Maybe a queue name would be enough? I'm just thinking about how it can be done in a bit more explicit fashion.
My rationale behind unit of work was that one may want to have different period/threshold based on job class and/or args. I guess the most straight-forward API in this case will be:
c.cooldown_period = lambda do |queue_name, message|
job_record = Sidekiq::JobRecord.new(message)
if job_record.display_class == "FooJob"
1.0
elsif "default" == queue_name
2.0
else
3.0
end
end
Naturally, in this case, it will also support:
c.cooldown_period = lambda do |queue_name|
if "default" == queue_name
2.0
else
3.0
end
end
After giving it another thought, I think we can keep it simple :D just queue name.
After giving it another thought, I think we can keep it simple :D just queue name.
I like the Sidekiq::JobRecord
idea tho. 😄
I like the
Sidekiq::JobRecord
idea tho. 😄
I do like it too. But it will involve object creation even when user does not need it (e.g. just caring about queue_name. Thus passing queue_name
where the message arrived from and message
give full flexibility without sacrificing performance.
I'm inclined towards do |queue, message|
approach.
Will wait with final decision until real case scenario appears.
Allow
Config#cooldown_period
andConfig#cooldown_threshold
to be specified as Proc:This will go very well in pair with planned push-back strategies PR.