Class: Sidekiq::Postpone
- Inherits:
-
Object
- Object
- Sidekiq::Postpone
- Defined in:
- lib/sidekiq/postpone/version.rb,
lib/sidekiq/postpone/core_ext.rb,
lib/sidekiq/postpone.rb
Defined Under Namespace
Modules: CoreExt
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*client_args) ⇒ Postpone
constructor
A new instance of Postpone.
- #push(payloads) ⇒ Object
- #wrap ⇒ Object
Constructor Details
#initialize(*client_args) ⇒ Postpone
Returns a new instance of Postpone.
8 9 10 11 12 |
# File 'lib/sidekiq/postpone.rb', line 8 def initialize(*client_args) @client_args = client_args setup_queues setup_schedule end |
Class Method Details
.wrap(&block) ⇒ Object
24 25 26 |
# File 'lib/sidekiq/postpone.rb', line 24 def self.wrap(&block) new.wrap(&block) end |
Instance Method Details
#push(payloads) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/sidekiq/postpone.rb', line 28 def push(payloads) if payloads.first['at'] @schedule.concat(payloads) else q = payloads.first['queue'] @queues[q].concat(payloads) end end |
#wrap ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/sidekiq/postpone.rb', line 14 def wrap start yield.tap do stop flush end ensure stop end |