Skip to content

Commit 061cd76

Browse files
authored
Merge pull request #70 from SovereignCloudStack/kr/defer-mutex
🐛 defer unlocking of mutex
2 parents c7b714d + ef49da9 commit 061cd76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/controller/clusterstackrelease_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ func (r *ClusterStackReleaseReconciler) Reconcile(ctx context.Context, req recon
113113
// acquire lock so that only one reconcile loop can download the release
114114
r.clusterStackRelDownloadDirectoryMutex.Lock()
115115

116+
defer r.clusterStackRelDownloadDirectoryMutex.Unlock()
117+
116118
gc, err := r.GitHubClientFactory.NewClient(ctx)
117119
if err != nil {
118120
conditions.MarkFalse(clusterStackRelease,
@@ -131,8 +133,6 @@ func (r *ClusterStackReleaseReconciler) Reconcile(ctx context.Context, req recon
131133
return reconcile.Result{}, fmt.Errorf("failed to download release assets: %w", err)
132134
}
133135

134-
r.clusterStackRelDownloadDirectoryMutex.Unlock()
135-
136136
// requeue to make sure release assets can be accessed
137137
return reconcile.Result{Requeue: true}, nil
138138
}

0 commit comments

Comments
 (0)