FIX: Retry sending email in case of temporary issue. (#6375)

This commit is contained in:
Bianca Nenciu 2018-10-04 16:56:24 +02:00 committed by Régis Hanol
parent 5b56a8cd09
commit e0e0a91e7d
1 changed files with 13 additions and 0 deletions

View File

@ -5,8 +5,21 @@ module Jobs
class NotifyMailingListSubscribers < Jobs::Base
include Skippable
RETRY_TIMES = [5.minute, 15.minute, 30.minute, 45.minute, 90.minute, 180.minute, 300.minute]
sidekiq_options queue: 'low'
sidekiq_options retry: RETRY_TIMES.size
sidekiq_retry_in do |count, exception|
case exception.wrapped
when SocketError
RETRY_TIMES[count]
else
Jobs::UserEmail.seconds_to_delay(count)
end
end
def execute(args)
return if SiteSetting.disable_mailing_list_mode