Don't go into an infinite await when stopping the app if the webapi is running
This commit is contained in:
parent
78c139293f
commit
29a2e5c4a2
1 changed files with 10 additions and 12 deletions
|
@ -95,12 +95,16 @@ namespace Geekbot.Bot
|
||||||
RegisterDependencies();
|
RegisterDependencies();
|
||||||
if (!runParameters.DisableGateway) await RegisterHandlers();
|
if (!runParameters.DisableGateway) await RegisterHandlers();
|
||||||
|
|
||||||
_logger.Information(LogSource.Api, "Starting Web API");
|
if (runParameters.DisableApi)
|
||||||
StartWebApi();
|
{
|
||||||
|
_logger.Information(LogSource.Geekbot, "Done and ready for use");
|
||||||
_logger.Information(LogSource.Geekbot, "Done and ready for use");
|
await Task.Delay(-1);
|
||||||
|
}
|
||||||
await Task.Delay(-1);
|
else
|
||||||
|
{
|
||||||
|
_logger.Information(LogSource.Api, "Starting Web API");
|
||||||
|
StartWebApi();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Login()
|
private async Task Login()
|
||||||
|
@ -222,12 +226,6 @@ namespace Geekbot.Bot
|
||||||
|
|
||||||
private void StartWebApi()
|
private void StartWebApi()
|
||||||
{
|
{
|
||||||
if (_runParameters.DisableApi)
|
|
||||||
{
|
|
||||||
_logger.Warning(LogSource.Api, "Web API is disabled");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var highscoreManager = new HighscoreManager(_databaseInitializer.Initialize(), _userRepository);
|
var highscoreManager = new HighscoreManager(_databaseInitializer.Initialize(), _userRepository);
|
||||||
WebApiStartup.StartWebApi(_servicesProvider, _logger, _runParameters, _commands, _databaseInitializer.Initialize(), _client, _globalSettings, highscoreManager);
|
WebApiStartup.StartWebApi(_servicesProvider, _logger, _runParameters, _commands, _databaseInitializer.Initialize(), _client, _globalSettings, highscoreManager);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue