Skip to content

Commit

Permalink
fix: deadlock in snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Nov 16, 2023
1 parent 4c95908 commit 93b2120
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/orchestrator/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ func (r *RepoOrchestrator) updateSnapshotsIfNeeded(ctx context.Context, force bo
return nil
}

r.mu.Lock()
defer r.mu.Unlock()

startTime := time.Now()

Expand Down Expand Up @@ -97,11 +95,14 @@ func (r *RepoOrchestrator) SnapshotsForPlan(ctx context.Context, plan *v1.Plan)
}

func (r *RepoOrchestrator) Backup(ctx context.Context, plan *v1.Plan, progressCallback func(event *restic.BackupProgressEntry)) (*restic.BackupProgressEntry, error) {
zap.L().Debug("repo orchestrator starting backup", zap.String("repo", r.repoConfig.Id))
snapshots, err := r.SnapshotsForPlan(ctx, plan)
if err != nil {
return nil, fmt.Errorf("failed to get snapshots for plan: %w", err)
}

zap.L().Debug("got snapshots for plan", zap.String("repo", r.repoConfig.Id), zap.Int("count", len(snapshots)), zap.String("plan", plan.Id), zap.String("tag", tagForPlan(plan)))

r.mu.Lock()
defer r.mu.Unlock()

Expand Down

0 comments on commit 93b2120

Please sign in to comment.