mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-08 16:02:20 +02:00
test: serve browser assets without head-of-line blocking
The shared static server handled one connection at a time. Chromium can open a speculative connection and never send a request, so every queued request waited behind it. Under parallel load a computed-style capture's navigation stalled for 30s and failed. Under CPU saturation, 4 of 12 captures stalled for about 29s each. Serve each connection on a daemon thread. The existing serve-this-worktree test now holds a silent connection open while it fetches, and times out against the serial server. The configuration reference's recorded source lines are unchanged.
This commit is contained in:
+4
-2
@@ -195,8 +195,8 @@ def _serve_test_static():
|
||||
return "text/css"
|
||||
return super().guess_type(path)
|
||||
|
||||
class _Server(socketserver.TCPServer):
|
||||
allow_reuse_address = True
|
||||
class _Server(socketserver.ThreadingTCPServer):
|
||||
allow_reuse_address = daemon_threads = True
|
||||
|
||||
requested = int(os.environ.get("ODYSSEUS_TEST_STATIC_PORT") or 0)
|
||||
if not 0 <= requested <= 65535:
|
||||
@@ -214,6 +214,8 @@ def _serve_test_static():
|
||||
previous_origin = os.environ.get("ODYSSEUS_TEST_STATIC_ORIGIN")
|
||||
os.environ["ODYSSEUS_TEST_STATIC_ORIGIN"] = origin
|
||||
|
||||
# One thread per connection: Chromium can hold a speculative connection
|
||||
# open without a request, which stalled serial service for ~30s.
|
||||
thread = threading.Thread(target=server.serve_forever, daemon=True)
|
||||
thread.start()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user