Fix the bot starting when using --debuginfo (#6131)

This commit is contained in:
Jakub Kuczys 2023-05-11 22:55:13 +02:00 committed by GitHub
parent 1d828c447c
commit e7d7eba68f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -268,7 +268,7 @@ def _copy_data(data):
def early_exit_runner(
cli_flags: Namespace,
func: Union[Callable[[], Awaitable[Any]], Callable[[Red, Namespace], Awaitable[Any]]],
) -> None:
) -> NoReturn:
"""
This one exists to not log all the things like it's a full run of the bot.
"""
@ -277,6 +277,7 @@ def early_exit_runner(
try:
if not cli_flags.instance_name:
loop.run_until_complete(func())
sys.exit(ExitCodes.SHUTDOWN)
return
data_manager.load_basic_configuration(cli_flags.instance_name)
@ -288,11 +289,13 @@ def early_exit_runner(
except (KeyboardInterrupt, EOFError):
print("Aborted!")
finally:
loop.run_until_complete(asyncio.sleep(1))
# note: sleep is unnecessary since we're not making any network connections
asyncio.set_event_loop(None)
loop.stop()
loop.close()
sys.exit(ExitCodes.SHUTDOWN)
async def run_bot(red: Red, cli_flags: Namespace) -> None:
"""