Skip to content

Commit

Permalink
Merge pull request #70 from SovereignCloudStack/kr/defer-mutex
Browse files Browse the repository at this point in the history
🐛 defer unlocking of mutex
  • Loading branch information
kranurag7 authored Feb 16, 2024
2 parents c7b714d + ef49da9 commit 061cd76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/controller/clusterstackrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ func (r *ClusterStackReleaseReconciler) Reconcile(ctx context.Context, req recon
// acquire lock so that only one reconcile loop can download the release
r.clusterStackRelDownloadDirectoryMutex.Lock()

defer r.clusterStackRelDownloadDirectoryMutex.Unlock()

gc, err := r.GitHubClientFactory.NewClient(ctx)
if err != nil {
conditions.MarkFalse(clusterStackRelease,
Expand All @@ -131,8 +133,6 @@ func (r *ClusterStackReleaseReconciler) Reconcile(ctx context.Context, req recon
return reconcile.Result{}, fmt.Errorf("failed to download release assets: %w", err)
}

r.clusterStackRelDownloadDirectoryMutex.Unlock()

// requeue to make sure release assets can be accessed
return reconcile.Result{Requeue: true}, nil
}
Expand Down

0 comments on commit 061cd76

Please sign in to comment.