diff --git a/app/jobs/retry_mqtt_message_job.rb b/app/jobs/retry_mqtt_message_job.rb index 1d1f507e..e359d6a7 100644 --- a/app/jobs/retry_mqtt_message_job.rb +++ b/app/jobs/retry_mqtt_message_job.rb @@ -1,21 +1,22 @@ class RetryMQTTMessageJob < ApplicationJob class RetryMessageHandlerError < RuntimeError end + queue_as :mqtt_retry - retry_on RetryMessageHandlerError, attempts: 75, wait: ->(count) { + retry_on(RetryMessageHandlerError, attempts: 75, wait: ->(count) { case count when 0..12 5.seconds when 12..20 # Every 30 seconds for the first 5 minutes 30.seconds - when 20..75 # Then every minute for an hour + else # Then every minute for an hour 1.minute - else - :polynomially_longer end - } + }) do |_job, _exeception| + # No-op, this block ensures the exception isn't reraised and retried by Sidekiq + end def perform(topic, message) result = MqttMessagesHandler.handle_topic(topic, message, false)