mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-13 17:34:15 +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)
|
private async Task ClientHealthCheck(CancellationToken ct)
|
||||||
{
|
{
|
||||||
while (!ct.IsCancellationRequested)
|
while (!ct.IsCancellationRequested && _mareHub != null)
|
||||||
{
|
{
|
||||||
await Task.Delay(TimeSpan.FromSeconds(30), ct).ConfigureAwait(false);
|
await Task.Delay(TimeSpan.FromSeconds(30), ct).ConfigureAwait(false);
|
||||||
if (ct.IsCancellationRequested) break;
|
if (ct.IsCancellationRequested) break;
|
||||||
|
|
@ -313,6 +313,7 @@ public partial class ApiController : IDisposable, IMareHubClient
|
||||||
|
|
||||||
Task.Run(async () => await StopConnection(_connectionCancellationTokenSource.Token).ConfigureAwait(false));
|
Task.Run(async () => await StopConnection(_connectionCancellationTokenSource.Token).ConfigureAwait(false));
|
||||||
_connectionCancellationTokenSource?.Cancel();
|
_connectionCancellationTokenSource?.Cancel();
|
||||||
|
_healthCheckTokenSource?.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private HubConnection BuildHubConnection(string hubName)
|
private HubConnection BuildHubConnection(string hubName)
|
||||||
|
|
@ -361,6 +362,7 @@ public partial class ApiController : IDisposable, IMareHubClient
|
||||||
if (_mareHub is not null)
|
if (_mareHub is not null)
|
||||||
{
|
{
|
||||||
_initialized = false;
|
_initialized = false;
|
||||||
|
_healthCheckTokenSource?.Cancel();
|
||||||
_uploadCancellationTokenSource?.Cancel();
|
_uploadCancellationTokenSource?.Cancel();
|
||||||
Logger.Info("Stopping existing connection");
|
Logger.Info("Stopping existing connection");
|
||||||
_mareHub.Closed -= MareHubOnClosed;
|
_mareHub.Closed -= MareHubOnClosed;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue