garethgeorge / backrest

Backrest is a web UI and orchestrator for restic backup.
GNU General Public License v3.0
1.73k stars 50 forks source link

Add retry strategy if hook cancels operation #405

Closed rikroe closed 1 month ago

rikroe commented 4 months ago

Note: if you have a question or want discussion please post in the discussions area.

Is your feature request related to a problem? Please describe. I use backrest to backup an external SSD on a laptop. There is no guarantee that the SSD is plugged in/mounted. I want backrest to try and run a Backup at least once a day, if the SSD is available.

To check if the SSD is available, I use the following hook.

image

This works as a backup task will get cancelled if the SSD is not available. However the next task will then be scheduled based on the timestamp of the last cancelled run instead of the last successful run.

image

Describe the solution you'd like I would like backrest to retry a cancelled operation (this probably should include a delay).

Ideas how this could be implemented (not having thought it through completely):

Additional context While I could partly deal with this issue by reducing the backup schedule do 1 hour intervals, this would lead to a lot of unneeded backup tasks (some cancelled, some actually creating snapshots).

garethgeorge commented 3 months ago

hey, thanks for the detailed request. I think this is a good idea and makes sense for a number of use cases (including a couple I have myself).

No ETA to provide re: implementation, but retrying backoff for hook failures is something I'll aim to get to.

garethgeorge commented 3 months ago

Starting to prototype this in https://github.com/garethgeorge/backrest/pull/428

garethgeorge commented 3 months ago

Merged in retry support, will go out with next release.

rikroe commented 3 months ago

Thank you so much! Didn't find the time to figure out compiling myself and testing the PR but will check once released!