mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 16:33:44 +08:00
FIX: Retry sending email in case of temporary issue. (#6375)
This commit is contained in:
parent
5b56a8cd09
commit
e0e0a91e7d
|
@ -5,8 +5,21 @@ module Jobs
|
||||||
class NotifyMailingListSubscribers < Jobs::Base
|
class NotifyMailingListSubscribers < Jobs::Base
|
||||||
include Skippable
|
include Skippable
|
||||||
|
|
||||||
|
RETRY_TIMES = [5.minute, 15.minute, 30.minute, 45.minute, 90.minute, 180.minute, 300.minute]
|
||||||
|
|
||||||
sidekiq_options queue: 'low'
|
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)
|
def execute(args)
|
||||||
return if SiteSetting.disable_mailing_list_mode
|
return if SiteSetting.disable_mailing_list_mode
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user