Module: Resque::Integration::Continuous
- Defined in:
- lib/resque/integration/continuous.rb
Overview
Continuous job can re-enqueue self with respect to resque-lock and resque-meta.
Instance Method Summary collapse
-
#after_perform_continue(*args) ⇒ Object
‘after` callbacks are executed after `around` callbacks so here we can re-enqueue the job, because lock (from resque-lock) already released.
-
#after_perform_reset_meta ⇒ Object
This callback resets Meta’s finish flags.
-
#before_perform_continue ⇒ Object
Just to ensure that previous jobs won’t affect current.
Instance Method Details
#after_perform_continue(*args) ⇒ Object
‘after` callbacks are executed after `around` callbacks so here we can re-enqueue the job, because lock (from resque-lock) already released
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/resque/integration/continuous.rb', line 47 def after_perform_continue(*args) if continued? args = if @continued.any? if unique? = args.first # we should keep meta_id as first argument [] + @continued else @continued end else args end ::Resque.enqueue(self, *args) end end |
#after_perform_reset_meta ⇒ Object
This callback resets Meta’s finish flags
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/resque/integration/continuous.rb', line 29 def (*) if = .data.delete('succeeded') .data.delete('finished_at') .save end end |
#before_perform_continue ⇒ Object
Just to ensure that previous jobs won’t affect current
41 42 43 |
# File 'lib/resque/integration/continuous.rb', line 41 def before_perform_continue(*) @continued = nil end |