Skip to content
Snippets Groups Projects
Commit 0383fada authored by Sybren A. Stüvel's avatar Sybren A. Stüvel
Browse files

(hopefully) fixed race condition between HTTP connection and shutdown.

If the keyboard interrupt is received while the "may I run" task is just
connecting to the Manager, it would cause an exception that would halt the
graceful shutdown.
parent b673aa90
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,8 @@ import asyncio ...@@ -5,6 +5,8 @@ import asyncio
import logging import logging
import logging.config import logging.config
import requests
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
...@@ -98,7 +100,10 @@ def main(): ...@@ -98,7 +100,10 @@ def main():
except KeyboardInterrupt: except KeyboardInterrupt:
shutdown_future.cancel() shutdown_future.cancel()
mir_work_task.cancel() mir_work_task.cancel()
loop.run_until_complete(mir_work_task) try:
loop.run_until_complete(mir_work_task)
except requests.exceptions.ConnectionError:
log.warning("Unable to connect to HTTP server, but that's fine as we're shutting down.")
fworker.shutdown() fworker.shutdown()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment