feat: prevent notifications for scheduled backups#2439
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughIntroduces an ChangesAutomated backup flag and notification skip
Sequence Diagram(s)sequenceDiagram
participant CreateBackupSchema
participant InitiateBackupService
participant Backup
participant BackupCompletedListener
CreateBackupSchema->>InitiateBackupService: handle(server, name, override, true, true)
InitiateBackupService->>Backup: create(is_automated: true)
Backup-->>BackupCompletedListener: backup completed event
alt automated and successful
BackupCompletedListener->>BackupCompletedListener: return early (skip notification)
else otherwise
BackupCompletedListener->>BackupCompletedListener: load data and send notification
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
You can already set I think it's completely acceptable for somebody to want to be emailed when their backups finish successfully. |
I highly disagree, see the attached issue of this PR. |
|
Thank you for reopening this. I was a bit frustrated I wasn't allowed the ability to voice my concerns with this. I have a large number of servers and they each have backups scheduled every hour, at various times within the hour. This caused me to get 2-3 emails every 5 minutes on average. I came back to my desk after a a long break to see hundreds of success emails. And I thought to myself... "This can't possibly be the intended experience. There's no way anyone would possibly want this many emails." Nevertheless, apparently it was. I personally feel that scheduled backups should NOT email the user if they were successful. The only time a user should receive a success message is if they initiated the action directly. |
Closes #2343
What does this PR do?
This PR resolves an issue where scheduled backups generate notifications via the UI and email upon completion. For servers with frequent automated backups, this causes notification spam.
This change ensures that notifications are suppressed for successful automated backups. If an automated backup fails, the administrator will still be notified to ensure visibility into backup failures. Manual backups remain unaffected and will generate notifications as usual.
Implementation Details
is_automatedboolean column (defaulting tofalse) to thebackupstable to track the source of the backup.Backupmodel to handle the newis_automatedproperty.InitiateBackupService::handle()to accept and save an$isAutomatedparameter.CreateBackupSchema::runTask()(the scheduler) to passtruefor$isAutomatedwhen initiating a backup.BackupCompletedListener::handle()to abort and skip sending Filament UI and email notifications if$event->backup->is_automatedand$event->backup->is_successfulare both true.How to Test