Sha256: 1c58dbf9e055030c44ae7ce001a908406074350627ba6c4e871e72a32544cc32

Contents?: true

Size: 564 Bytes

Versions: 7

Compression:

Stored size: 564 Bytes

Contents

# frozen_string_literal: true

require 'delayed_job_recurring'

module Totoro
  class MessageResender
    include Delayed::RecurringJob
    run_every 10.second
    queue 'totoro'
    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 StandardError => error
      Rails.logger.error error.message
      STDOUT.flush
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
totoro-0.6.1 lib/totoro/message_resender.rb
totoro-0.6.0 lib/totoro/message_resender.rb
totoro-0.5.7 lib/totoro/message_resender.rb
totoro-0.5.6 lib/totoro/message_resender.rb
totoro-0.5.5 lib/totoro/message_resender.rb
totoro-0.5.4 lib/totoro/message_resender.rb
totoro-0.5.3 lib/totoro/message_resender.rb