Initialize migration. (#88)
Co-authored-by: defnotken <itsdefnotken@gmail.com> Co-authored-by: cake <admin@cakeandbanana.nl> Reviewed-on: #88 Reviewed-by: cake <cake@noreply.git.lightless-sync.org> Co-authored-by: defnotken <defnotken@noreply.git.lightless-sync.org> Co-committed-by: defnotken <defnotken@noreply.git.lightless-sync.org>
This commit was merged in pull request #88.
This commit is contained in:
@@ -190,7 +190,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
||||
Logger.LogInformation("Not recreating Connection, paused");
|
||||
_connectionDto = null;
|
||||
await StopConnectionAsync(ServerState.Disconnected).ConfigureAwait(false);
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
if (_connectionCancellationTokenSource != null)
|
||||
{
|
||||
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -204,7 +207,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
||||
Mediator.Publish(new NotificationMessage("Multiple Identical Characters detected", "Your Service configuration has multiple characters with the same name and world set up. Delete the duplicates in the character management to be able to connect to Lightless.",
|
||||
NotificationType.Error));
|
||||
await StopConnectionAsync(ServerState.MultiChara).ConfigureAwait(false);
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
if (_connectionCancellationTokenSource != null)
|
||||
{
|
||||
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -213,7 +219,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
||||
Logger.LogWarning("No secret key set for current character");
|
||||
_connectionDto = null;
|
||||
await StopConnectionAsync(ServerState.NoSecretKey).ConfigureAwait(false);
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
if (_connectionCancellationTokenSource != null)
|
||||
{
|
||||
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -227,7 +236,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
||||
Mediator.Publish(new NotificationMessage("Multiple Identical Characters detected", "Your Service configuration has multiple characters with the same name and world set up. Delete the duplicates in the character management to be able to connect to Lightless.",
|
||||
NotificationType.Error));
|
||||
await StopConnectionAsync(ServerState.MultiChara).ConfigureAwait(false);
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
if (_connectionCancellationTokenSource != null)
|
||||
{
|
||||
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -236,7 +248,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
||||
Logger.LogWarning("No UID/OAuth set for current character");
|
||||
_connectionDto = null;
|
||||
await StopConnectionAsync(ServerState.OAuthMisconfigured).ConfigureAwait(false);
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
if (_connectionCancellationTokenSource != null)
|
||||
{
|
||||
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -245,7 +260,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
||||
Logger.LogWarning("OAuth2 login token could not be updated");
|
||||
_connectionDto = null;
|
||||
await StopConnectionAsync(ServerState.OAuthLoginTokenStale).ConfigureAwait(false);
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
if (_connectionCancellationTokenSource != null)
|
||||
{
|
||||
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +274,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
||||
Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Informational,
|
||||
$"Starting Connection to {_serverManager.CurrentServer.ServerName}")));
|
||||
|
||||
_connectionCancellationTokenSource?.Cancel();
|
||||
if (_connectionCancellationTokenSource != null)
|
||||
{
|
||||
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
|
||||
}
|
||||
_connectionCancellationTokenSource?.Dispose();
|
||||
_connectionCancellationTokenSource = new CancellationTokenSource();
|
||||
var token = _connectionCancellationTokenSource.Token;
|
||||
@@ -730,7 +751,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
|
||||
$"Stopping existing connection to {_serverManager.CurrentServer.ServerName}")));
|
||||
|
||||
_initialized = false;
|
||||
_healthCheckTokenSource?.Cancel();
|
||||
if (_healthCheckTokenSource != null)
|
||||
{
|
||||
await _healthCheckTokenSource.CancelAsync().ConfigureAwait(false);
|
||||
}
|
||||
Mediator.Publish(new DisconnectedMessage());
|
||||
_lightlessHub = null;
|
||||
_connectionDto = null;
|
||||
|
||||
Reference in New Issue
Block a user