Class: Totoro::MessageResender

Inherits:
Object
  • Object
show all
Includes:
Delayed::RecurringJob
Defined in:
lib/totoro/message_resender.rb

Instance Method Summary collapse

Instance Method Details

#performObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/totoro/message_resender.rb', line 10

def perform
  Totoro::Queue.connection
  Totoro::TotoroFailedMessage.find_in_batches(batch_size: 100) do |message_group|
    message_group.each do |m|
      m.class_name.constantize.enqueue(m.queue_id, m.payload)
      m.destroy
    end
  end
rescue Bunny::TCPConnectionFailedForAllHosts => error
  Rails.logger.error error.message
  STDOUT.flush
end