Fix backup check notifications and workload recovery; release 2026.09.21.r001
This commit is contained in:
@@ -1052,8 +1052,12 @@ func (s *Service) execute(ctx context.Context, run model.Run) (result model.Run)
|
||||
ctx = restic.WithRunID(ctx, run.ID)
|
||||
maintenanceRepoName := ""
|
||||
defer func() {
|
||||
if result.TaskType == "prune" && (result.Status == "success" || result.Status == "warning" || result.Status == "failed") {
|
||||
go s.notify("Repository-Bereinigung", maintenanceRepoName, result)
|
||||
if (result.TaskType == "prune" || result.TaskType == "check") && (result.Status == "success" || result.Status == "warning" || result.Status == "failed") {
|
||||
name := "Repository-Bereinigung"
|
||||
if result.TaskType == "check" {
|
||||
name = "Repository-Prüfung"
|
||||
}
|
||||
s.notify(name, maintenanceRepoName, result)
|
||||
}
|
||||
}()
|
||||
if run.TaskType == "backup" {
|
||||
@@ -1543,18 +1547,20 @@ func (s *Service) finishJob(run model.Run, job model.Job, result model.Run) mode
|
||||
repoName = repo.Name
|
||||
}
|
||||
}
|
||||
go s.notify(job.Name, repoName, result)
|
||||
s.notify(job.Name, repoName, result)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *Service) notify(name, repository string, run model.Run) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
title := notificationTitle(name, repository, run)
|
||||
message := notificationMessage(name, repository, run, time.Now().UTC())
|
||||
for _, target := range s.Config().Notifications {
|
||||
for _, event := range target.Events {
|
||||
if event == run.Status {
|
||||
if err := s.notifier.Send(context.Background(), target, title, message, run.Status); err != nil {
|
||||
if err := s.notifier.Send(ctx, target, title, message, run.Status); err != nil {
|
||||
s.log.Warn("send notification failed", "target", target.ID, "type", target.Type, "error", err)
|
||||
}
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user