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); jobs.UpdateJob(job);
} }
} }
}
catch
{
// error updating the job
}
if (_executingTask == null) // stop called without start
{ if (_executingTask == null)
return; {
} return;
}
try
{
// force cancellation of the executing method
_cancellationTokenSource.Cancel(); _cancellationTokenSource.Cancel();
} }
finally 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);
} }
} }

View File

@ -58,6 +58,7 @@ namespace Oqtane
services.AddLocalization(options => options.ResourcesPath = "Resources"); services.AddLocalization(options => options.ResourcesPath = "Resources");
services.AddOptions<List<Database>>().Bind(Configuration.GetSection(SettingKeys.AvailableDatabasesSection)); services.AddOptions<List<Database>>().Bind(Configuration.GetSection(SettingKeys.AvailableDatabasesSection));
services.Configure<HostOptions>(opts => opts.ShutdownTimeout = TimeSpan.FromSeconds(10)); // increase from default of 5 seconds
services.AddServerSideBlazor() services.AddServerSideBlazor()
.AddCircuitOptions(options => .AddCircuitOptions(options =>