chore: Move Twilio event processing to background job (#11094)
- Twilio events were being processed synchronously, leading to slow API responses. - This change moves Twilio event processing to a background job to improve performance and align with how other events (e.g., WhatsApp) are handled. --------- Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
8
app/jobs/webhooks/twilio_delivery_status_job.rb
Normal file
8
app/jobs/webhooks/twilio_delivery_status_job.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class Webhooks::TwilioDeliveryStatusJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform(params = {})
|
||||
# Process the Twilio delivery status webhook event in the background
|
||||
::Twilio::DeliveryStatusService.new(params: params).perform
|
||||
end
|
||||
end
|
||||
8
app/jobs/webhooks/twilio_events_job.rb
Normal file
8
app/jobs/webhooks/twilio_events_job.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class Webhooks::TwilioEventsJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform(params = {})
|
||||
# Process the Twilio webhook event in the background
|
||||
::Twilio::IncomingMessageService.new(params: params).perform
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user