Class: Qless::JobReservers::ShuffledRoundRobin
- Inherits:
-
RoundRobin
- Object
- RoundRobin
- Qless::JobReservers::ShuffledRoundRobin
- Defined in:
- lib/qless/job_reservers/shuffled_round_robin.rb
Overview
Like round-robin but shuffles the order of the queues
Constant Summary collapse
- TYPE_DESCRIPTION =
'shuffled round robin'
Instance Attribute Summary
Attributes inherited from RoundRobin
Instance Method Summary collapse
-
#initialize(queues) ⇒ ShuffledRoundRobin
constructor
A new instance of ShuffledRoundRobin.
- #prep_for_work! ⇒ Object
Methods inherited from RoundRobin
#description, #reserve, #reset_description!
Constructor Details
#initialize(queues) ⇒ ShuffledRoundRobin
Returns a new instance of ShuffledRoundRobin.
9 10 11 |
# File 'lib/qless/job_reservers/shuffled_round_robin.rb', line 9 def initialize(queues) super(queues.shuffle) end |
Instance Method Details
#prep_for_work! ⇒ Object
13 14 15 16 |
# File 'lib/qless/job_reservers/shuffled_round_robin.rb', line 13 def prep_for_work! @queues = @queues.shuffle reset_description! end |