"lib/bindings/c/vscode:/vscode.git/clone" did not exist on "3718da8c689a558b7958f462bc3d00a1bbcced3e"
Unverified Commit 2d59861e authored by Thomas Montfort's avatar Thomas Montfort Committed by GitHub
Browse files

fix: frontend component handles graceful shutdown (#3481)

parent 07207a1b
......@@ -21,6 +21,7 @@ import logging
import os
import pathlib
import re
import signal
import uvloop
......@@ -226,7 +227,15 @@ async def async_main():
if prefix:
os.environ["DYN_METRICS_PREFIX"] = flags.metrics_prefix
runtime = DistributedRuntime(asyncio.get_running_loop(), is_static)
loop = asyncio.get_running_loop()
runtime = DistributedRuntime(loop, is_static)
def signal_handler():
asyncio.create_task(graceful_shutdown(runtime))
for sig in (signal.SIGTERM, signal.SIGINT):
loop.add_signal_handler(sig, signal_handler)
if flags.router_mode == "kv":
router_mode = RouterMode.KV
......@@ -289,6 +298,10 @@ async def async_main():
pass
async def graceful_shutdown(runtime):
runtime.shutdown()
def main():
uvloop.run(async_main())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment