1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2025-02-25 09:46:01 +01:00

Fix exception while shutting down instance procedures

This commit is contained in:
chylex 2023-03-28 03:45:00 +02:00
parent a9646c5bbc
commit 2180e0c067
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548

View File

@ -32,10 +32,6 @@ sealed class InstanceProcedureManager : IAsyncDisposable {
return (await currentProcedure.Get(cancellationToken))?.Procedure;
}
public async Task CancelCurrentProcedure() {
(await currentProcedure.Get(shutdownCancellationTokenSource.Token))?.CancellationTokenSource.Cancel();
}
private async Task Run() {
try {
var shutdownCancellationToken = shutdownCancellationTokenSource.Token;
@ -77,7 +73,7 @@ sealed class InstanceProcedureManager : IAsyncDisposable {
public async ValueTask DisposeAsync() {
shutdownCancellationTokenSource.Cancel();
await CancelCurrentProcedure();
(await currentProcedure.Get(CancellationToken.None))?.CancellationTokenSource.Cancel();
await procedureQueueFinished.WaitHandle.WaitOneAsync();
currentProcedure.Dispose();