From 5111301d8ca201e3e1f232a83279ebe3e01e6a88 Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Thu, 16 Nov 2023 01:32:02 -0800 Subject: [PATCH] fix: deadlock in snapshots --- internal/orchestrator/repo.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/orchestrator/repo.go b/internal/orchestrator/repo.go index 6c7a385d..366a98b6 100644 --- a/internal/orchestrator/repo.go +++ b/internal/orchestrator/repo.go @@ -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() @@ -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()