chore: Migrate mailers from the worker to jobs (#12331)
Previously, email replies were handled inside workers. There was no execution logs. This meant if emails silently failed (as reported by a customer), we had no way to trace where the issue happened, the only assumption was “no error = mail sent.” By moving email handling into jobs, we now have proper execution logs for each attempt. This makes it easier to debug delivery issues and would have better visibility when investigating customer reports. Fixes https://linear.app/chatwoot/issue/CW-5538/emails-are-not-sentdelivered-to-the-contact --------- Co-authored-by: Sojan Jose <sojan@pepalo.com> Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
This commit is contained in:
@@ -6,9 +6,21 @@ Sidekiq.configure_client do |config|
|
||||
config.redis = Redis::Config.app
|
||||
end
|
||||
|
||||
# Logs whenever a job is pulled off Redis for execution.
|
||||
class ChatwootDequeuedLogger
|
||||
def call(_worker, job, queue)
|
||||
Sidekiq.logger.info("Dequeued #{job['class']} #{job['jid']} from #{queue}")
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = Redis::Config.app
|
||||
|
||||
config.server_middleware do |chain|
|
||||
chain.add ChatwootDequeuedLogger
|
||||
end
|
||||
|
||||
# skip the default start stop logging
|
||||
if Rails.env.production?
|
||||
config.logger.formatter = Sidekiq::Logger::Formatters::JSON.new
|
||||
|
||||
Reference in New Issue
Block a user