From c4ae9015912115d0d9ea8449170b57c4cff290d9 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Tue, 13 Apr 2021 14:09:51 +0530 Subject: [PATCH] chore: Fix Twilio file uploads (#2088) --- app/models/message.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/message.rb b/app/models/message.rb index 064441e3b..8c834e2ed 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -148,7 +148,9 @@ class Message < ApplicationRecord end def send_reply - ::SendReplyJob.perform_later(id) + # FIXME: Giving it few seconds for the attachment to be uploaded to the service + # active storage attaches the file only after commit + attachments.blank? ? ::SendReplyJob.perform_later(id) : ::SendReplyJob.set(wait: 2.seconds).perform_later(id) end def reopen_conversation