From 2bb2d02476c0bc3f24b9d45a162adb05e554b3b3 Mon Sep 17 00:00:00 2001 From: MarekWo Date: Fri, 30 Jan 2026 12:28:41 +0100 Subject: [PATCH] fix: Force connection close to prevent stale connections in scheduler Added 'Connection: close' header to bridge requests to prevent connection pooling issues when running from APScheduler background thread context. Co-Authored-By: Claude Opus 4.5 --- app/meshcore/cli.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/meshcore/cli.py b/app/meshcore/cli.py index 0eb4ae7..de46574 100644 --- a/app/meshcore/cli.py +++ b/app/meshcore/cli.py @@ -43,6 +43,7 @@ def _run_command(args: list, timeout: int = DEFAULT_TIMEOUT) -> Tuple[bool, str, 'args': args, 'timeout': timeout }, + headers={'Connection': 'close'}, # Prevent connection reuse issues in background threads timeout=timeout + 5 # Add 5s buffer for HTTP timeout )