chore: Improve Whatsapp Templates Sync (#7210)
- update the templates updated at, even if the API request fails ( to prevent jobs from stacking up in case of API failures upstream ) - sequence the job in batches of 25 requests per minutes schedule ( in case API response time is high, also not to send too many requests in a single batch ) - move the sync job re-rerun to 3 hours ( since we are updating the updated at even in case of failures )(prev 15 minutes ) Fixes: https://linear.app/chatwoot/issue/CW-1590
This commit is contained in:
@@ -11,7 +11,7 @@ RSpec.describe Channels::Whatsapp::TemplatesSyncSchedulerJob do
|
||||
stub_request(:post, 'https://waba.360dialog.io/v1/configs/webhook')
|
||||
non_synced = create(:channel_whatsapp, sync_templates: false, message_templates_last_updated: nil)
|
||||
synced_recently = create(:channel_whatsapp, sync_templates: false, message_templates_last_updated: Time.zone.now)
|
||||
synced_old = create(:channel_whatsapp, sync_templates: false, message_templates_last_updated: 16.minutes.ago)
|
||||
synced_old = create(:channel_whatsapp, sync_templates: false, message_templates_last_updated: 4.hours.ago)
|
||||
described_class.perform_now
|
||||
expect(Channels::Whatsapp::TemplatesSyncJob).not_to(
|
||||
have_been_enqueued.with(synced_recently).on_queue('low')
|
||||
|
||||
Reference in New Issue
Block a user