Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit e35fd87

Browse files
committed
Allow the delay in the feature flag refresh loop to be cancelled (#306)
Progress on NuGet/NuGetGallery#7439
1 parent cb2b9e4 commit e35fd87

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/NuGet.Services.FeatureFlags/FeatureFlagCacheService.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,15 @@ public async Task RefreshAsync()
8888
staleness,
8989
_options.RefreshInterval);
9090

91-
await Task.Delay(_options.RefreshInterval);
91+
try
92+
{
93+
await Task.Delay(_options.RefreshInterval, cancellationToken);
94+
}
95+
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
96+
{
97+
// Swallow the cancelled delay operation to allow quiet shutdown of the refresh loop. A cancelled
98+
// delay operation is harmless to the system.
99+
}
92100
}
93101
}
94102

0 commit comments

Comments
 (0)