Skip to content

Commit

Permalink
fix: minor hook and naming bugs in check and backup tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Jun 14, 2024
1 parent 793666c commit e2ef66e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Download options
- Build from source ([see below](#building)).
- Run with docker: `garethgeorge/backrest:latest` ([see on dockerhub](https://hub.docker.com/r/garethgeorge/backrest)) or `garethgeorge/backrest:latest-alpine` for an image that includes rclone and common unix utilities.

Backrest is accessible from a web browser. By default it binds to `0.0.0.0:9898` and can be accessed at `http://localhost:9898`. Change the port with the `BACKREST_PORT` environment variable e.g. `BACKREST_PORT=127.0.0.1 backrest` to listen only on local interfaces. On first startup backrest will prompt you to create a default username and password, this can be changed later in the settings page.
Backrest is accessible from a web browser. By default it binds to `127.0.0.1:9898` and can be accessed at `http://localhost:9898`. Change the port with the `BACKREST_PORT` environment variable e.g. `BACKREST_PORT=0.0.0.0:9898 backrest` to listen on all network interfaces. On first startup backrest will prompt you to create a default username and password, this can be changed later in the settings page.

> [!Note]
> Backrest installs a specific restic version to ensure that the version of restic matches the version Backrest is tested against. This provides the best guarantees for stability. If you wish to use a different version of restic OR if you would prefer to install restic manually you may do so by setting the `BACKREST_RESTIC_COMMAND` environment variable to the path of the restic binary you wish to use.
Expand Down
6 changes: 3 additions & 3 deletions internal/orchestrator/tasks/taskbackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,24 @@ func (t *BackupTask) Run(ctx context.Context, st ScheduledTask, runner TaskRunne
SnapshotStats: summary,
SnapshotId: summary.SnapshotId,
}

if err != nil {
vars.Error = err.Error()
if !errors.Is(err, restic.ErrPartialBackup) {
runner.ExecuteHooks([]v1.Hook_Condition{
v1.Hook_CONDITION_SNAPSHOT_ERROR,
v1.Hook_CONDITION_ANY_ERROR,
v1.Hook_CONDITION_SNAPSHOT_END,
}, vars)
return err
} else {
vars.Error = fmt.Sprintf("partial backup, %d files may not have been read completely.", len(backupOp.OperationBackup.Errors))
runner.ExecuteHooks([]v1.Hook_Condition{
v1.Hook_CONDITION_SNAPSHOT_WARNING,
}, vars)
}
op.Status = v1.OperationStatus_STATUS_WARNING
op.DisplayMessage = "Partial backup, some files may not have been read completely."

runner.ExecuteHooks([]v1.Hook_Condition{
v1.Hook_CONDITION_SNAPSHOT_WARNING,
v1.Hook_CONDITION_SNAPSHOT_END,
}, vars)
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/orchestrator/tasks/taskcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (t *CheckTask) Next(now time.Time, runner TaskRunner) (ScheduledTask, error
lastRan = time.Now()
}

zap.L().Debug("last prune time", zap.Time("time", lastRan), zap.String("repo", t.RepoID()))
zap.L().Debug("last check time", zap.Time("time", lastRan), zap.String("repo", t.RepoID()))

runAt, err := protoutil.ResolveSchedule(repo.CheckPolicy.GetSchedule(), lastRan)
if errors.Is(err, protoutil.ErrScheduleDisabled) {
Expand Down

0 comments on commit e2ef66e

Please sign in to comment.