Commit 89f32b9
committed
perf(tests): skip thread.join in run_server_in_thread teardown
uvicorn polls should_exit every 0.1s in its main_loop and adds another
0.1s sleep in shutdown(), so thread.join() blocks ~200ms per fixture
teardown. With 60+ fixture-using tests in test_streamable_http.py, that
was ~12s of pure shutdown latency.
The thread is a daemon, so signaling exit and moving on is safe — the
interpreter reaps it. The socket is still closed by uvicorn's shutdown,
releasing the port.
Sequential runtime for affected files: 24s → 13s (old multiprocessing
baseline was 16s). Parallel (-n 14) runtime unchanged at ~4.5s.1 parent e9d75da commit 89f32b9
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| |||
0 commit comments