mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 19:47:21 +01:00
cancel healthcheck on stopconnection
This commit is contained in:
parent
2e4bbe3540
commit
858cb225b9
1 changed files with 3 additions and 1 deletions
|
|
@ -251,7 +251,7 @@ public partial class ApiController : IDisposable, IMareHubClient
|
|||
|
||||
private async Task ClientHealthCheck(CancellationToken ct)
|
||||
{
|
||||
while (!ct.IsCancellationRequested)
|
||||
while (!ct.IsCancellationRequested && _mareHub != null)
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(30), ct).ConfigureAwait(false);
|
||||
if (ct.IsCancellationRequested) break;
|
||||
|
|
@ -313,6 +313,7 @@ public partial class ApiController : IDisposable, IMareHubClient
|
|||
|
||||
Task.Run(async () => await StopConnection(_connectionCancellationTokenSource.Token).ConfigureAwait(false));
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
_healthCheckTokenSource?.Cancel();
|
||||
}
|
||||
|
||||
private HubConnection BuildHubConnection(string hubName)
|
||||
|
|
@ -361,6 +362,7 @@ public partial class ApiController : IDisposable, IMareHubClient
|
|||
if (_mareHub is not null)
|
||||
{
|
||||
_initialized = false;
|
||||
_healthCheckTokenSource?.Cancel();
|
||||
_uploadCancellationTokenSource?.Cancel();
|
||||
Logger.Info("Stopping existing connection");
|
||||
_mareHub.Closed -= MareHubOnClosed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue