Class: Qless::JobReservers::ShuffledRoundRobin

Inherits:
RoundRobin
  • Object
show all
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

#queues

Instance Method Summary collapse

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