From 729ff771cf70edd73bbf3bf6251cd19c1acb507d Mon Sep 17 00:00:00 2001 From: Thomas HERVE Date: Tue, 11 Jun 2024 14:24:12 +0200 Subject: [PATCH] Try the auto server suppression --- instance/app.py | 2 ++ instance/run.sh | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100755 instance/run.sh diff --git a/instance/app.py b/instance/app.py index c587dd0..7960708 100644 --- a/instance/app.py +++ b/instance/app.py @@ -40,6 +40,8 @@ async def handler(websocket, path): clients.remove(websocket) if websocket == server: server = None + if len(clients) == 0: + stop() async def main(): async with websockets.serve(handler, "0.0.0.0", 8000): diff --git a/instance/run.sh b/instance/run.sh deleted file mode 100755 index 2df97f7..0000000 --- a/instance/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -hug -f app/__init__.py \ No newline at end of file