chore: Move Whatsapp template sync to cron (#4858)
syncing WhatsApp templates job is moved to a cron job for a better user experience. The Templates are synced at 15-minute intervals now.
This commit is contained in:
@@ -34,6 +34,15 @@ FactoryBot.define do
|
||||
end
|
||||
message_templates_last_updated { Time.now.utc }
|
||||
|
||||
transient do
|
||||
sync_templates { true }
|
||||
end
|
||||
|
||||
before(:create) do |channel_whatsapp, options|
|
||||
# since factory already has the required message templates, we just need to bypass it getting updated
|
||||
channel_whatsapp.define_singleton_method(:sync_templates) { return } unless options.sync_templates
|
||||
end
|
||||
|
||||
after(:create) do |channel_whatsapp|
|
||||
create(:inbox, channel: channel_whatsapp, account: channel_whatsapp.account)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user