From 9696184420dbe3c8433a220598e199ae9f35d77c Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas@kluyver.me.uk>
Date: Thu, 17 Nov 2022 14:47:05 +0000
Subject: [PATCH] Create quit_event after fork

---
 calparrot/proxy.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/calparrot/proxy.py b/calparrot/proxy.py
index 4adbb64..a14ee0e 100644
--- a/calparrot/proxy.py
+++ b/calparrot/proxy.py
@@ -176,8 +176,9 @@ class ShutdownHandler(RequestHandler):
 
 
 class ProxyApp:
+    quit_event: asyncio.Event
+
     def __init__(self, creds, db_path='calparrot.sqlite'):
-        self.quit_event = asyncio.Event()
         self.response_store = ResponsesDB(db_path)
         base_url = creds['base_url'].rstrip('/')  # e.g. https://in.xfel.eu/calibration
 
@@ -210,6 +211,7 @@ class ProxyApp:
 
     async def serve(self):
         """Serve requests until asked to quit"""
+        self.quit_event = asyncio.Event()
         server = HTTPServer(self.tornado_app)
         # add_sockets hooks up the server to the event loop
         server.add_sockets(self.sockets)
-- 
GitLab