Move Salmon processing to background as well as PuSH

lolsob-rspec
Eugen Rochko 2016-11-18 23:24:57 +01:00
parent b373fb0ff6
commit fbaddca49e
2 changed files with 10 additions and 1 deletions

View File

@ -10,7 +10,7 @@ class Api::SalmonController < ApiController
if body.nil?
head 200
else
ProcessInteractionService.new.call(body, @account)
SalmonWorker.perform_async(@account.id, body.force_encoding('UTF-8'))
head 201
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
class SalmonWorker
include Sidekiq::Worker
def perform(account_id, body)
ProcessInteractionService.new.call(body, Account.find(account_id))
end
end