feat(backup): retry backup after failed attempt #765
feat(backup): retry backup after failed attempt #765Der-Penz wants to merge 10 commits intonicotsx:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
There was a problem hiding this comment.
Thank you @Der-Penz for your work, looks great! There is one problem tho that I can see it's in the following case:
- You have a backup schedule with a hourly cron
- It starts at 10:00
- Fails at 10:05
- Next backup is set to 11:05 due to failure + default value
- Your planned run at 11:00 is "lost" or pushed later
I think we need to do a small computation before setting the next retry to see if the actual next schedule happens before the planned retry and skip retries in this case
| const maxRetries = schedule.maxRetries; | ||
| const shouldRetry = currentRetryCount < maxRetries; | ||
|
|
||
| if (shouldRetry) { |
There was a problem hiding this comment.
Additionally, I think the retry mechanism should not trigger when running a backup manually from the UI
There was a problem hiding this comment.
I've injected the manual parameter to the function. I did not find another way to get information about if it was triggered manually. If there is i can revert it again
|
Thanks for the great feedback. I would say it can be like this. It will try to schedule the specified backup x times but if the retried backup is after the next specified normal scheduled backup it will not do anymore retry-backups and reset the counter to 0. So when the actual next scheduled backup starts and fails the counter is at 0 again. |

Summary
This adds the option to retry the backup job if the backup failed for some reason (e.g. The target repository was not online).
It includes the option to configure for each backup job how often it should retry the failed backup and what duration will be between backups. This can be configured in the Advanced settings of the backup job. By default it will try 3 Backups in 60 minutes intervals.
if a retry of the backup failed the maximum number of times and a new scheduled backup is also failing it wont try again so it will only exhaust the maxRetries once.
Changes
Testing
I run a hourly backup local and it with 3 retry attempts and 25 minutes interval which worked fine. Resetting the failed attempt counter on successful backup also worked correctly.
Note
I used AI to get an initial draft on how to implement it and where i need to change something. But i looked over each change and reviewed/improved it.
Closes #481
I am open for feedback. Let me know if there is anything thats not done correctly or missing and I will try to improve it.