Restructure omni services and add Chatwoot research snapshot
This commit is contained in:
17
research/chatwoot/app/jobs/webhooks/facebook_events_job.rb
Normal file
17
research/chatwoot/app/jobs/webhooks/facebook_events_job.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Webhooks::FacebookEventsJob < MutexApplicationJob
|
||||
queue_as :default
|
||||
retry_on LockAcquisitionError, wait: 1.second, attempts: 8
|
||||
|
||||
def perform(message)
|
||||
response = ::Integrations::Facebook::MessageParser.new(message)
|
||||
|
||||
key = format(::Redis::Alfred::FACEBOOK_MESSAGE_MUTEX, sender_id: response.sender_id, recipient_id: response.recipient_id)
|
||||
with_lock(key) do
|
||||
process_message(response)
|
||||
end
|
||||
end
|
||||
|
||||
def process_message(response)
|
||||
::Integrations::Facebook::MessageCreator.new(response).perform
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user