diff --git a/app/jobs/retry_mqtt_message_job.rb b/app/jobs/retry_mqtt_message_job.rb index de868f9d..88eb2f6b 100644 --- a/app/jobs/retry_mqtt_message_job.rb +++ b/app/jobs/retry_mqtt_message_job.rb @@ -1,5 +1,17 @@ class RetryMQTTMessageJob < ApplicationJob - queue_as :default + queue_as :mqtt_retry + + sidekiq_retry_in do |count| + case count + when 0..10 # Every 30 seconds for the first 5 minutes + 30.seconds + when 11..55 # Then every minute for an hour + 1.minute + else + false # Fallback to default backoff after an hour, + # see https://github.com/sidekiq/sidekiq/issues/2338 + end + end def perform(topic, message) result = MqttMessagesHandler.handle_topic(topic, message, false) diff --git a/config/sidekiq.yml b/config/sidekiq.yml index b4636ea5..59939973 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -4,6 +4,7 @@ :queues: - default - mailers + - mqtt_retry production: :concurrency: 25