Skip to content

Commit

Permalink
handle possible case where the run task is waiting for activation and…
Browse files Browse the repository at this point in the history
… the cancellation has begun
  • Loading branch information
Ledjon Behluli authored and Ledjon Behluli committed Oct 30, 2024
1 parent 03e25f8 commit 70f1675
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Orleans.Core/Manifest/ClientClusterManifestProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,18 @@ public async Task StopAsync(CancellationToken cancellationToken)
try
{
_cancellation.Cancel();
if (_runTask is { IsCompleted: false } _task)
{
await _task.WaitAsync(cancellationToken);
}
}
catch (Exception exception)
catch (OperationCanceledException)
{
_logger.LogError(exception, "Error cancelling shutdown token.");
_logger.LogInformation("Stoping of {Component} was canceled.", nameof(ClientClusterManifestProvider));
}

if (_runTask is { IsCompleted: false } task)
catch (Exception exception)
{
await task.WaitAsync(cancellationToken);
_logger.LogError(exception, "Error stopping {Component}.", nameof(ClientClusterManifestProvider));
}
}

Expand Down

0 comments on commit 70f1675

Please sign in to comment.