spatie / laravel-backup

A package to backup your Laravel app

Home Page:https://spatie.be/docs/laravel-backup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I receive two email notifications whenever a backup fails

trevorgehman opened this issue · comments

I have an odd, longstanding problem that I simply cannot figure out. Whenever a backup fails, it will always send two identical email notifications at the exact same time:

CleanShot 2023-04-26 at 18 29 15@2x

It doesn't matter if the error is due to a timeout, or a S3 issue, I will always get two emails in the event of a failure.

My configuration is set up with a single email:

CleanShot 2023-04-26 at 18 34 32@2x

And the backup is configured to run once, but it does have 'runInBackground()' specified:

CleanShot 2023-04-26 at 18 35 43@2x

I'm on version 8.1.7, and PHP 8.2 and MySQL 8.0.32.

The only thing I can think of is that somehow the backup:run job is running twice and is actually the cause of the failures, explaining multiple emails. But not sure how that could be happening.

I can see locally in Telescope that if I set the timeout to 1 second, it fails and there are multiple "BackupHasFailed" events being thrown, which I believe is why multiple notifications are sent:

CleanShot 2023-04-26 at 20 03 37@2x

Duplicate of #1553??

Duplicate of #1553??

Yes looks like that is the same issue. This seems to be a legitimate bug, as I'm not sure why it's necessary to fire that event more than once, especially since notifications are sent as a result.

I'm not sure why it's necessary to fire that event more than once

It's not that "it's necessary", it's a logic mistake that went unnoticed

#1553 (comment)

Feel free to make a PR to fix that

I'd indeed accept a PR that fixes this.