From 994d948c3947b75140c2a2a7de5b81713c7b8ea3 Mon Sep 17 00:00:00 2001 From: Clworld Date: Thu, 27 Jul 2017 07:38:20 +0900 Subject: Add callback_url/acct information for Sidekiq PuSH workers Exception. (#4281) * Add destination informations to exception on SubscribeWorker and DeliveryWorker. * Simplify delivery error message. * Prevent changing Exception type... * fix typo. --- app/workers/pubsubhubbub/subscribe_worker.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/workers/pubsubhubbub/subscribe_worker.rb') diff --git a/app/workers/pubsubhubbub/subscribe_worker.rb b/app/workers/pubsubhubbub/subscribe_worker.rb index 6865e7136..9178079d4 100644 --- a/app/workers/pubsubhubbub/subscribe_worker.rb +++ b/app/workers/pubsubhubbub/subscribe_worker.rb @@ -22,5 +22,7 @@ class Pubsubhubbub::SubscribeWorker account = Account.find(account_id) logger.debug "PuSH re-subscribing to #{account.acct}" ::SubscribeService.new.call(account) + rescue => e + raise e.class, "Subscribe failed for #{account&.acct}: #{e.message}" end end -- cgit From 6e186b9c77e7f23da6b46b901aace1c0b3b163ad Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 28 Jul 2017 17:21:14 +0200 Subject: When PuSH subscribe attempts are exhausted, unsubscribe (#4422) --- app/workers/pubsubhubbub/subscribe_worker.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/workers/pubsubhubbub/subscribe_worker.rb') diff --git a/app/workers/pubsubhubbub/subscribe_worker.rb b/app/workers/pubsubhubbub/subscribe_worker.rb index 9178079d4..7560c2671 100644 --- a/app/workers/pubsubhubbub/subscribe_worker.rb +++ b/app/workers/pubsubhubbub/subscribe_worker.rb @@ -3,7 +3,7 @@ class Pubsubhubbub::SubscribeWorker include Sidekiq::Worker - sidekiq_options queue: 'push', retry: 10, unique: :until_executed + sidekiq_options queue: 'push', retry: 10, unique: :until_executed, dead: false sidekiq_retry_in do |count| case count @@ -18,6 +18,12 @@ class Pubsubhubbub::SubscribeWorker end end + sidekiq_retries_exhausted do |msg, _e| + account = Account.find(msg['args'].first) + logger.error "PuSH subscription attempts for #{account.acct} exhausted. Unsubscribing" + ::UnsubscribeService.new.call(account) + end + def perform(account_id) account = Account.find(account_id) logger.debug "PuSH re-subscribing to #{account.acct}" -- cgit