-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hi,
nearly did the same, than found your project, nice work !!!
Regarding your Service Worker some suggestion, maybe it makes sense to use a BackgroundService ExecuteAsync and await for appLifetime.ApplicationStarted.
I don't like the fixed _hostLifetime.StopApplication(); either. I should be open who decides to quite the application, it could be done on a command level with _hostLifetime.StopApplication();
Maybe even individual configuration of the worker could be passed via UseSpectreConsole + Action< SpectreServiceWorkerConfig >
public Task StartAsync(CancellationToken cancellationToken)
{
return Task.Factory.StartNew(async () =>
{
try
{
var args = GetArgs();
await Task.Delay(100, cancellationToken); //Just to let Microsoft.Hosting finish.
_exitCode = await _commandApp.RunAsync(args);
}
catch (Exception ex)
{
_logger.LogError(ex, "An unexpected error occurred");
_exitCode = 1;
}
finally
{
_hostLifetime.StopApplication();
}
}, cancellationToken);
}
JuergenRB
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request