Fix SSE server blocking: use ThreadingHTTPServer
HTTPServer is single-threaded, so the wallpaper's persistent SSE connection blocked all subsequent requests. ThreadingHTTPServer handles each connection in its own thread. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
85726b8c41
commit
fa5c99c30d
1 changed files with 2 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ Run as: cava -p cava.conf | python3 cava-server.py
|
|||
import sys
|
||||
import threading
|
||||
import time
|
||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||
from http.server import ThreadingHTTPServer, BaseHTTPRequestHandler
|
||||
|
||||
latest = ""
|
||||
lock = threading.Lock()
|
||||
|
|
@ -36,7 +36,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||
pass
|
||||
|
||||
def serve():
|
||||
HTTPServer(("127.0.0.1", 5555), Handler).serve_forever()
|
||||
ThreadingHTTPServer(("127.0.0.1", 5555), Handler).serve_forever()
|
||||
|
||||
threading.Thread(target=serve, daemon=True).start()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue