Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
Delegate processing of incoming PuSH data to background workers
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron committed Nov 15, 2016
1 parent cea28e0 commit a91c3ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/subscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def update
subscription = @account.subscription(api_subscription_url(@account.id))

if subscription.verify(body, request.headers['HTTP_X_HUB_SIGNATURE'])
ProcessFeedService.new.call(body, @account)
ProcessingWorker.perform_async(@account.id, body.force_encoding('UTF-8'))
head 201
else
head 202
Expand Down
7 changes: 7 additions & 0 deletions app/workers/processing_worker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ProcessingWorker
include Sidekiq::Worker

def perform(account_id, body)
ProcessFeedService.new.call(body, Account.find(account_id))
end
end

0 comments on commit a91c3ef

Please sign in to comment.