From 0deae354db0e5f64c1a686394c04568c7f62b086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 24 Oct 2023 12:44:56 +0200 Subject: [PATCH] persist service after first request We still have the advantage of zero downtime restarts but given this is on the only service on the machine we can just run it all the time --- nixpkgs_merge_bot/server.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/nixpkgs_merge_bot/server.py b/nixpkgs_merge_bot/server.py index 22ddfdc..348bb16 100644 --- a/nixpkgs_merge_bot/server.py +++ b/nixpkgs_merge_bot/server.py @@ -13,17 +13,13 @@ def start_server(settings: Settings) -> None: fds = range(3, 3 + int(nfds)) for fd in fds: sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM) - sock.settimeout(0) - try: - while True: + while True: + try: GithubWebHook(*sock.accept(), settings) - except BlockingIOError: - # no more connections - pass - except OSError: - # connection closed - pass + except OSError: + # connection closed + pass else: serversocket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) try: