Move Salmon processing to background as well as PuSH
This commit is contained in:
		@@ -10,7 +10,7 @@ class Api::SalmonController < ApiController
 | 
				
			|||||||
    if body.nil?
 | 
					    if body.nil?
 | 
				
			||||||
      head 200
 | 
					      head 200
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      ProcessInteractionService.new.call(body, @account)
 | 
					      SalmonWorker.perform_async(@account.id, body.force_encoding('UTF-8'))
 | 
				
			||||||
      head 201
 | 
					      head 201
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								app/workers/salmon_worker.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/workers/salmon_worker.rb
									
									
									
									
									
										Normal 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
 | 
				
			||||||
		Reference in New Issue
	
	Block a user