Class: Jiggler::Scheduled::Requeuer
- Inherits:
-
Object
- Object
- Jiggler::Scheduled::Requeuer
- Includes:
- Jiggler::Support::Helper
- Defined in:
- lib/jiggler/scheduled/requeuer.rb
Instance Method Summary collapse
- #handle_stale ⇒ Object
-
#initialize(config) ⇒ Requeuer
constructor
A new instance of Requeuer.
- #terminate ⇒ Object
Methods included from Jiggler::Support::Helper
#log_error, #log_error_short, #logger, #safe_async, #scan_all, #tid
Constructor Details
#initialize(config) ⇒ Requeuer
Returns a new instance of Requeuer.
8 9 10 11 12 |
# File 'lib/jiggler/scheduled/requeuer.rb', line 8 def initialize(config) @config = config @done = false @tid = tid end |
Instance Method Details
#handle_stale ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jiggler/scheduled/requeuer.rb', line 14 def handle_stale requeue_data.each do |(rqueue, queue, _)| @config.with_async_redis do |conn| loop do return if @done # reprocessing is prioritised so we push at the right side break if conn.call('LMOVE', rqueue, queue, 'RIGHT', 'RIGHT').nil? end end end rescue => err log_error_short(err, context: '\'Requeuing jobs error\'', tid: @tid) end |
#terminate ⇒ Object
28 29 30 |
# File 'lib/jiggler/scheduled/requeuer.rb', line 28 def terminate @done = true end |