Skip to content

Commit 905a23f

Browse files
ryanflavornotdp
authored andcommitted
fix: use ThreadingHTTPServer to prevent blocking on concurrent connections
When using VS Code Remote or other tools that establish multiple HTTP connections, the single-threaded HTTPServer can become blocked, making the web dashboard inaccessible. ThreadingHTTPServer handles each request in a separate thread, preventing this blocking issue while maintaining the same API.
1 parent e8f81ed commit 905a23f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bin/serve.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import secrets
1010
import subprocess
1111
import sys
12+
import threading
1213
import urllib.request
1314
import urllib.error
1415
from urllib.parse import unquote
@@ -710,7 +711,7 @@ def run(port, web_dir, oroio_dir, dk_path, pin_hash=None):
710711
*args, oroio_dir=oroio_dir, dk_path=dk_path, **kwargs
711712
)
712713

713-
with http.server.HTTPServer(('0.0.0.0', port), handler) as httpd:
714+
with http.server.ThreadingHTTPServer(('0.0.0.0', port), handler) as httpd:
714715
httpd.serve_forever()
715716

716717
if __name__ == '__main__':

0 commit comments

Comments
 (0)