fix #2041 - Server restart post module install fails with null exception

This commit is contained in:
Shaun Walker
2022-03-07 12:19:00 -05:00
parent b80fe428ac
commit fd89254d5a
2 changed files with 16 additions and 5 deletions

View File

@ -266,17 +266,27 @@ namespace Oqtane.Infrastructure
jobs.UpdateJob(job);
}
}
}
catch
{
// error updating the job
}
if (_executingTask == null)
{
return;
}
// stop called without start
if (_executingTask == null)
{
return;
}
try
{
// force cancellation of the executing method
_cancellationTokenSource.Cancel();
}
finally
{
await Task.WhenAny(_executingTask, Task.Delay(Timeout.Infinite, cancellationToken));
// wait until the task completes or the stop token triggers
await Task.WhenAny(_executingTask, Task.Delay(Timeout.Infinite, cancellationToken)).ConfigureAwait(false);
}
}