Make enabling Silent Mode take effect immediately
Problem
Enabling/disabling Silent Mode seems to take a minute before suppressing/allowing outbound emails. The delay is unexpected and undesirable. When enabling Silent Mode upon Geo site promotion (as in a bubble test), it needs to take effect immediately. Otherwise, outgoing communications may be sent from the silenced site.
Steps to reproduce with Mailers
- If using Geo, then in your primary site, run
gdk tail rails-background-jobs | grep "Delivered\|Skipped delivery"
- Trigger various emails. For example, comment on an issue.
- Notice log output like
Delivered mail 6424f56bcc078_6e8f3bc4-3a@Michaels-MBP.mail (2.3ms)
. And<gdk url>/rails/letter_opener
should show delivered emails. - Enable Silent mode in Admin Area > Settings
- Trigger various emails
-
Notice log output continues to deliver mail for some time.
❌ - After a minute or so of triggering emails, notice log output like
Skipped delivery of mail 6424f5311896f_6cca3bc4-3a@Michaels-MBP.mail as
perform_deliveriesis false
. And emails should stop appearing in<gdk url>/rails/letter_opener
. - Disable Silent mode
- Trigger various emails
-
Notice log output continues to block mail delivery for some time.
❌ - After a minute or so of triggering emails, notice log output delivers mail again
Steps to reproduce with webhooks
In addition to the impact on Silent Mode + Mailers, I think we saw this delay with webhooks too. But I'm not 100%.
Similar to above but instead of watching logs and triggering emails, you can trigger webhooks and get feedback in the UI like so:
- Visit a project's Settings > Webhooks
- Add a webhook to
https://httpstat.us/200
(a test resource that always responds 200 OK) which triggers on Comments - Click Test > Comments to trigger a call to the webhook
When Silent Mode is enabled, the call should fail and an error should be displayed.
Proposal
Make enabling Silent Mode take effect immediately.
Relevant code
It's unclear at the moment if the delay is with the Application Setting or with the Mailers.