From 4c6809f6ab7e5082eaf3a005246cbff6a110496d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 19 Dec 2016 09:31:12 +0100 Subject: [PATCH] Adding some rescues to workers, e.g. don't fail removal job when status can't be found in the first place (already removed) --- app/workers/distribution_worker.rb | 2 ++ app/workers/pubsubhubbub/distribution_worker.rb | 2 ++ app/workers/removal_worker.rb | 2 ++ 3 files changed, 6 insertions(+) diff --git a/app/workers/distribution_worker.rb b/app/workers/distribution_worker.rb index 09374bee29..f423d43ae5 100644 --- a/app/workers/distribution_worker.rb +++ b/app/workers/distribution_worker.rb @@ -5,5 +5,7 @@ class DistributionWorker def perform(status_id) FanOutOnWriteService.new.call(Status.find(status_id)) + rescue ActiveRecord::RecordNotFound + true end end diff --git a/app/workers/pubsubhubbub/distribution_worker.rb b/app/workers/pubsubhubbub/distribution_worker.rb index b0ddc71c1c..e88d11be0a 100644 --- a/app/workers/pubsubhubbub/distribution_worker.rb +++ b/app/workers/pubsubhubbub/distribution_worker.rb @@ -14,5 +14,7 @@ class Pubsubhubbub::DistributionWorker Subscription.where(account: account).active.select('id').find_each do |subscription| Pubsubhubbub::DeliveryWorker.perform_async(subscription.id, payload) end + rescue ActiveRecord::RecordNotFound + true end end diff --git a/app/workers/removal_worker.rb b/app/workers/removal_worker.rb index eae27c66fa..19a660dd3e 100644 --- a/app/workers/removal_worker.rb +++ b/app/workers/removal_worker.rb @@ -5,5 +5,7 @@ class RemovalWorker def perform(status_id) RemoveStatusService.new.call(Status.find(status_id)) + rescue ActiveRecord::RecordNotFound + true end end