Improve background jobs params and error handling

lolsob-rspec
Eugen Rochko 2017-01-05 03:28:21 +01:00
parent 66c5363bae
commit a893746e5a
5 changed files with 12 additions and 2 deletions

View File

@ -3,6 +3,8 @@
class NotificationWorker class NotificationWorker
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options retry: 5
def perform(stream_entry_id, target_account_id) def perform(stream_entry_id, target_account_id)
SendInteractionService.new.call(StreamEntry.find(stream_entry_id), Account.find(target_account_id)) SendInteractionService.new.call(StreamEntry.find(stream_entry_id), Account.find(target_account_id))
end end

View File

@ -4,7 +4,7 @@ class Pubsubhubbub::ConfirmationWorker
include Sidekiq::Worker include Sidekiq::Worker
include RoutingHelper include RoutingHelper
sidekiq_options queue: 'push' sidekiq_options queue: 'push', retry: false
def perform(subscription_id, mode, secret = nil, lease_seconds = nil) def perform(subscription_id, mode, secret = nil, lease_seconds = nil)
subscription = Subscription.find(subscription_id) subscription = Subscription.find(subscription_id)

View File

@ -4,7 +4,11 @@ class Pubsubhubbub::DeliveryWorker
include Sidekiq::Worker include Sidekiq::Worker
include RoutingHelper include RoutingHelper
sidekiq_options queue: 'push', retry: 5 sidekiq_options queue: 'push', retry: 3, dead: false
sidekiq_retry_in do |count|
5 * (count + 1)
end
def perform(subscription_id, payload) def perform(subscription_id, payload)
subscription = Subscription.find(subscription_id) subscription = Subscription.find(subscription_id)

View File

@ -3,6 +3,8 @@
class ThreadResolveWorker class ThreadResolveWorker
include Sidekiq::Worker include Sidekiq::Worker
sidekiq_options retry: false
def perform(child_status_id, parent_url) def perform(child_status_id, parent_url)
child_status = Status.find(child_status_id) child_status = Status.find(child_status_id)
parent_status = FetchRemoteStatusService.new.call(parent_url) parent_status = FetchRemoteStatusService.new.call(parent_url)

View File

@ -5,5 +5,7 @@ class UnfavouriteWorker
def perform(account_id, status_id) def perform(account_id, status_id)
UnfavouriteService.new.call(Account.find(account_id), Status.find(status_id)) UnfavouriteService.new.call(Account.find(account_id), Status.find(status_id))
rescue ActiveRecord::RecordNotFound
true
end end
end end