Class: Sidekiq::LimitFetch::Queues
- Inherits:
-
Object
- Object
- Sidekiq::LimitFetch::Queues
- Defined in:
- lib/sidekiq/limit_fetch/queues.rb
Constant Summary collapse
- THREAD_KEY =
:acquired_queues
Instance Attribute Summary collapse
-
#selector ⇒ Object
readonly
Returns the value of attribute selector.
Instance Method Summary collapse
- #acquire ⇒ Object
-
#initialize(options) ⇒ Queues
constructor
A new instance of Queues.
- #ordered_queues ⇒ Object
- #release_except(full_name) ⇒ Object
Constructor Details
#initialize(options) ⇒ Queues
Returns a new instance of Queues.
6 7 8 9 10 11 12 13 |
# File 'lib/sidekiq/limit_fetch/queues.rb', line 6 def initialize() @queues = [:queues] [:strict] ? strict_order! : weighted_order! set_selector [:global] set_limits [:limits] set_blocks [:blocking] end |
Instance Attribute Details
#selector ⇒ Object (readonly)
Returns the value of attribute selector.
4 5 6 |
# File 'lib/sidekiq/limit_fetch/queues.rb', line 4 def selector @selector end |
Instance Method Details
#acquire ⇒ Object
15 16 17 18 19 |
# File 'lib/sidekiq/limit_fetch/queues.rb', line 15 def acquire @selector.acquire(ordered_queues) .tap {|it| save it } .map {|it| "queue:#{it}" } end |
#ordered_queues ⇒ Object
46 |
# File 'lib/sidekiq/limit_fetch/queues.rb', line 46 def ordered_queues; @queues end |
#release_except(full_name) ⇒ Object
21 22 23 |
# File 'lib/sidekiq/limit_fetch/queues.rb', line 21 def release_except(full_name) @selector.release restore.delete_if {|name| full_name.to_s.include? name } end |