Fix: Add max retries for all jobs (#3582)

This commit is contained in:
Tejaswini Chile 2021-12-15 17:31:16 +05:30 committed by GitHub
parent 6ae06f2c7a
commit b7336eca65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 66 deletions

View file

@ -9,63 +9,63 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (6.1.4.1) actioncable (6.1.4.3)
actionpack (= 6.1.4.1) actionpack (= 6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.1.4.1) actionmailbox (6.1.4.3)
actionpack (= 6.1.4.1) actionpack (= 6.1.4.3)
activejob (= 6.1.4.1) activejob (= 6.1.4.3)
activerecord (= 6.1.4.1) activerecord (= 6.1.4.3)
activestorage (= 6.1.4.1) activestorage (= 6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.1.4.1) actionmailer (6.1.4.3)
actionpack (= 6.1.4.1) actionpack (= 6.1.4.3)
actionview (= 6.1.4.1) actionview (= 6.1.4.3)
activejob (= 6.1.4.1) activejob (= 6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.1.4.1) actionpack (6.1.4.3)
actionview (= 6.1.4.1) actionview (= 6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
rack (~> 2.0, >= 2.0.9) rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.4.1) actiontext (6.1.4.3)
actionpack (= 6.1.4.1) actionpack (= 6.1.4.3)
activerecord (= 6.1.4.1) activerecord (= 6.1.4.3)
activestorage (= 6.1.4.1) activestorage (= 6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.1.4.1) actionview (6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_record_query_trace (1.8) active_record_query_trace (1.8)
activejob (6.1.4.1) activejob (6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.1.4.1) activemodel (6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
activerecord (6.1.4.1) activerecord (6.1.4.3)
activemodel (= 6.1.4.1) activemodel (= 6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
activerecord-import (1.2.0) activerecord-import (1.2.0)
activerecord (>= 3.2) activerecord (>= 3.2)
activestorage (6.1.4.1) activestorage (6.1.4.3)
actionpack (= 6.1.4.1) actionpack (= 6.1.4.3)
activejob (= 6.1.4.1) activejob (= 6.1.4.3)
activerecord (= 6.1.4.1) activerecord (= 6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
marcel (~> 1.0.0) marcel (~> 1.0.0)
mini_mime (>= 1.1.0) mini_mime (>= 1.1.0)
activesupport (6.1.4.1) activesupport (6.1.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
@ -219,7 +219,7 @@ GEM
grpc (~> 1.25) grpc (~> 1.25)
geocoder (1.7.0) geocoder (1.7.0)
gli (2.20.1) gli (2.20.1)
globalid (0.5.2) globalid (1.0.0)
activesupport (>= 5.0) activesupport (>= 5.0)
google-apis-core (0.4.1) google-apis-core (0.4.1)
addressable (~> 2.5, >= 2.5.1) addressable (~> 2.5, >= 2.5.1)
@ -297,7 +297,7 @@ GEM
mime-types (~> 3.0) mime-types (~> 3.0)
multi_xml (>= 0.5.2) multi_xml (>= 0.5.2)
httpclient (2.8.3) httpclient (2.8.3)
i18n (1.8.10) i18n (1.8.11)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
image_processing (1.12.1) image_processing (1.12.1)
mini_magick (>= 4.9.5, < 5) mini_magick (>= 4.9.5, < 5)
@ -343,7 +343,7 @@ GEM
listen (3.7.0) listen (3.7.0)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.12.0) loofah (2.13.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
@ -358,7 +358,7 @@ GEM
mini_magick (4.11.0) mini_magick (4.11.0)
mini_mime (1.1.2) mini_mime (1.1.2)
mini_portile2 (2.5.3) mini_portile2 (2.5.3)
minitest (5.14.4) minitest (5.15.0)
mock_redis (0.29.0) mock_redis (0.29.0)
ruby2_keywords ruby2_keywords
momentjs-rails (2.20.1) momentjs-rails (2.20.1)
@ -402,7 +402,7 @@ GEM
pundit (2.1.1) pundit (2.1.1)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
raabro (1.4.0) raabro (1.4.0)
racc (1.5.2) racc (1.6.0)
rack (2.2.3) rack (2.2.3)
rack-attack (6.5.0) rack-attack (6.5.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
@ -413,29 +413,29 @@ GEM
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rack-timeout (0.6.0) rack-timeout (0.6.0)
rails (6.1.4.1) rails (6.1.4.3)
actioncable (= 6.1.4.1) actioncable (= 6.1.4.3)
actionmailbox (= 6.1.4.1) actionmailbox (= 6.1.4.3)
actionmailer (= 6.1.4.1) actionmailer (= 6.1.4.3)
actionpack (= 6.1.4.1) actionpack (= 6.1.4.3)
actiontext (= 6.1.4.1) actiontext (= 6.1.4.3)
actionview (= 6.1.4.1) actionview (= 6.1.4.3)
activejob (= 6.1.4.1) activejob (= 6.1.4.3)
activemodel (= 6.1.4.1) activemodel (= 6.1.4.3)
activerecord (= 6.1.4.1) activerecord (= 6.1.4.3)
activestorage (= 6.1.4.1) activestorage (= 6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 6.1.4.1) railties (= 6.1.4.3)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2) rails-html-sanitizer (1.4.2)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.1.4.1) railties (6.1.4.3)
actionpack (= 6.1.4.1) actionpack (= 6.1.4.3)
activesupport (= 6.1.4.1) activesupport (= 6.1.4.3)
method_source method_source
rake (>= 0.13) rake (>= 0.13)
thor (~> 1.0) thor (~> 1.0)
@ -573,9 +573,9 @@ GEM
sprockets (4.0.2) sprockets (4.0.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.2) sprockets-rails (3.4.2)
actionpack (>= 4.0) actionpack (>= 5.2)
activesupport (>= 4.0) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
squasher (0.6.2) squasher (0.6.2)
statsd-ruby (1.5.0) statsd-ruby (1.5.0)
@ -632,7 +632,7 @@ GEM
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
wisper (2.0.0) wisper (2.0.0)
zeitwerk (2.4.2) zeitwerk (2.5.1)
PLATFORMS PLATFORMS
arm64-darwin-20 arm64-darwin-20

View file

@ -2,6 +2,8 @@ class Inboxes::FetchImapEmailsJob < ApplicationJob
queue_as :low queue_as :low
def perform(channel) def perform(channel)
return unless channel.imap_enabled?
Mail.defaults do Mail.defaults do
retriever_method :imap, address: channel.imap_address, retriever_method :imap, address: channel.imap_address,
port: channel.imap_port, port: channel.imap_port,

View file

@ -1,6 +1,6 @@
class EmailReplyWorker class EmailReplyWorker
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options queue: :mailers sidekiq_options queue: :mailers, retry: 3
def perform(message_id) def perform(message_id)
message = Message.find(message_id) message = Message.find(message_id)

View file

@ -14,8 +14,8 @@ trigger_scheduled_items_job:
class: 'TriggerScheduledItemsJob' class: 'TriggerScheduledItemsJob'
queue: scheduled_jobs queue: scheduled_jobs
# executed At every minute. # executed At every 5th minute..
trigger_imap_email_inboxes_job: trigger_imap_email_inboxes_job:
cron: '*/1 * * * *' cron: '*/5 * * * *'
class: 'Inboxes::FetchImapEmailInboxesJob' class: 'Inboxes::FetchImapEmailInboxesJob'
queue: scheduled_jobs queue: scheduled_jobs

View file

@ -6,6 +6,7 @@
:verbose: false :verbose: false
:concurrency: 5 :concurrency: 5
:timeout: 25 :timeout: 25
:max_retries: 3
# Sidekiq will run this file through ERB when reading it so you can # Sidekiq will run this file through ERB when reading it so you can
# even put in dynamic logic, like a host-specific queue. # even put in dynamic logic, like a host-specific queue.
@ -25,7 +26,7 @@
- [action_mailbox_routing, 3] - [action_mailbox_routing, 3]
- [high, 5] - [high, 5]
- [critical, 10] - [critical, 10]
# you can override concurrency based on environment # you can override concurrency based on environment
production: production:
:concurrency: 10 :concurrency: 10