From 8cafdf0400984afaa3092d9ecde5b8188327deba Mon Sep 17 00:00:00 2001 From: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:29:15 -0400 Subject: [PATCH] Fix wsrelay KeyboardInteruption not respected (#15036) - stop wsrelay on keyboard interuption - restart wsrelay for any other failure reason --- awx/main/management/commands/run_wsrelay.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/main/management/commands/run_wsrelay.py b/awx/main/management/commands/run_wsrelay.py index bcd64be890..a3165cd669 100644 --- a/awx/main/management/commands/run_wsrelay.py +++ b/awx/main/management/commands/run_wsrelay.py @@ -171,5 +171,8 @@ class Command(BaseCommand): try: asyncio.run(websocket_relay_manager.run()) except KeyboardInterrupt: - logger.info('Restarting Websocket Relayer') + logger.info('Shutting down Websocket Relayer') + break + except Exception as e: + logger.exception('Error in Websocket Relayer, exception: {}. Restarting in 10 seconds'.format(e)) time.sleep(10)