Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add retry strategy if hook cancels operation #405

Closed
rikroe opened this issue Jul 28, 2024 · 4 comments
Closed

Add retry strategy if hook cancels operation #405

rikroe opened this issue Jul 28, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request p1

Comments

@rikroe
Copy link

rikroe commented Jul 28, 2024

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):

  • Add an additional error behaviour (ON_ERROR_RETRY)
  • Checkbox to schedule based on last successful task instead of any task
  • Being able to query the last successful execution of a backrest task and include this in the CONDITION_SNAPSHOT_START hook. This probably requires some addition to the template variables?

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).

@rikroe rikroe added the enhancement New feature or request label Jul 28, 2024
@garethgeorge garethgeorge added the p2 label Aug 6, 2024
@garethgeorge
Copy link
Owner

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 garethgeorge added p1 and removed p2 labels Aug 15, 2024
@garethgeorge
Copy link
Owner

Starting to prototype this in #428

@garethgeorge garethgeorge self-assigned this Aug 21, 2024
@garethgeorge
Copy link
Owner

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

@rikroe
Copy link
Author

rikroe commented Aug 27, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p1
Projects
None yet
Development

No branches or pull requests

2 participants