Skip to content

Commit 5f9f82e

Browse files
committed
Acquire Semaphore lock after the web requests have completed to minimize the downtime of the version cache when refreshing
1 parent 4727377 commit 5f9f82e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Server/Services/GitLab/VersionCache.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ public void Init(ProjectId projectId) => Executor.ExecuteBackgroundAsync(async (
111111

112112
public async Task RefreshAsync()
113113
{
114-
await _semaphore.WaitAsync();
115-
116114
_logger.LogInformation("Reloading version cache for {project}", _cachedProject!.Value.Name);
117115

118116
_latestTag = (await _gl.GetLatestReleaseAsync(_cachedProject.Value.Id))?.TagName;
@@ -135,6 +133,8 @@ public async Task RefreshAsync()
135133
if (releases is null)
136134
goto ReleaseLock;
137135

136+
await _semaphore.WaitAsync();
137+
138138
if (Count > 0)
139139
{
140140
_logger.LogInformation("Clearing {entryCount} version cache entries for {project}", Count,

0 commit comments

Comments
 (0)