add events
This commit is contained in:
@@ -135,6 +135,8 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
||||
await StopConnection(ServerState.Disconnected).ConfigureAwait(false);
|
||||
|
||||
Logger.LogInformation("Recreating Connection");
|
||||
Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Informational,
|
||||
$"Starting Connection to {_serverManager.CurrentServer.ServerName}")));
|
||||
|
||||
_connectionCancellationTokenSource.Cancel();
|
||||
_connectionCancellationTokenSource = new CancellationTokenSource();
|
||||
@@ -419,6 +421,9 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
||||
_healthCheckTokenSource?.Cancel();
|
||||
ServerState = ServerState.Reconnecting;
|
||||
Logger.LogWarning(arg, "Connection closed... Reconnecting");
|
||||
Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Warning,
|
||||
$"Connection interrupted, reconnecting to {_serverManager.CurrentServer.ServerName}")));
|
||||
|
||||
}
|
||||
|
||||
private async Task<bool> RefreshToken(CancellationToken ct)
|
||||
@@ -464,6 +469,9 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
||||
|
||||
if (_mareHub is not null)
|
||||
{
|
||||
Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Informational,
|
||||
$"Stopping existing connection to {_serverManager.CurrentServer.ServerName}")));
|
||||
|
||||
_initialized = false;
|
||||
_healthCheckTokenSource?.Cancel();
|
||||
Mediator.Publish(new DisconnectedMessage());
|
||||
|
||||
Reference in New Issue
Block a user