Sha256: 9834430c59a71a3bd86f024aba63180e5ac3a01f7c52b503bdb69c5a1abf156d

Contents?: true

Size: 510 Bytes

Versions: 8

Compression:

Stored size: 510 Bytes

Contents

# frozen_string_literal: true

module Totoro
  class ResendService
    def resend_all_messages
      Totoro::TotoroFailedMessage.find_in_batches(batch_size: 100) do |message_group|
        message_group.each { |m| resend_message(m) }
      end
    end

    private

    def resend_message(failed_message)
      queue_class = failed_message.class_name.constantize
      queue_class.method(failed_message.group).call(failed_message.queue_id, failed_message.payload)
      failed_message.destroy
    end
  end
end

Version data entries

8 entries across 7 versions & 1 rubygems

Version Path
totoro-1.0.7 lib/totoro/services/resend_service.rb
totoro-1.0.6 lib/totoro/services/resend_service.rb
totoro-1.0.6 pkg/totoro-1.0.5/lib/totoro/services/resend_service.rb
totoro-1.0.5 lib/totoro/services/resend_service.rb
totoro-1.0.4 lib/totoro/services/resend_service.rb
totoro-1.0.3 lib/totoro/services/resend_service.rb
totoro-1.0.2 lib/totoro/services/resend_service.rb
totoro-1.0.1 lib/totoro/services/resend_service.rb