Make enabling Silent Mode take effect immediately
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Work on this issue](https://contributors.gitlab.com/manage-issue?action=work&projectId=278964&issueIid=405433) - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=405433) </details> <!--IssueSummary end--> ## 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 1. If using Geo, then in your primary site, run `gdk tail rails-background-jobs | grep "Delivered\|Skipped delivery"` 1. Trigger various emails. For example, comment on an issue. 1. Notice log output like `Delivered mail 6424f56bcc078_6e8f3bc4-3a@Michaels-MBP.mail (2.3ms)`. And `<gdk url>/rails/letter_opener` should show delivered emails. 1. Enable **Silent mode** in Admin Area > Settings 1. Trigger various emails 1. **Notice log output continues to deliver mail for some time.** :x: 1. After a minute or so of triggering emails, notice log output like `Skipped delivery of mail 6424f5311896f_6cca3bc4-3a@Michaels-MBP.mail as `perform_deliveries` is false`. And emails should stop appearing in `<gdk url>/rails/letter_opener`. 1. Disable **Silent mode** 1. Trigger various emails 1. **Notice log output continues to block mail delivery for some time.** :x: 1. 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: 1. Visit a project's Settings > Webhooks 2. Add a webhook to `https://httpstat.us/200` (a test resource that always responds 200 OK) which triggers on Comments 3. 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.
issue