v1.0.159: SO_REUSEADDR + app.js via Python

This commit is contained in:
2026-06-23 17:17:58 +04:00
parent 79b6554316
commit 9b23148c16
+2 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""Contracts VM server — thin HTTP router. All logic in db/ and services/.""" """Contracts VM server — thin HTTP router. All logic in db/ and services/."""
from http.server import HTTPServer, BaseHTTPRequestHandler from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn from socketserver import ThreadingMixIn, TCPServer
from urllib.parse import urlparse, parse_qs from urllib.parse import urlparse, parse_qs
import json, re, os import json, re, os
@@ -227,6 +227,7 @@ class Handler(BaseHTTPRequestHandler):
if __name__ == "__main__": if __name__ == "__main__":
import os import os
TCPServer.allow_reuse_address = True
port = int(os.environ.get("PORT", "8766")) port = int(os.environ.get("PORT", "8766"))
server = ThreadingHTTPServer(("0.0.0.0", port), Handler) server = ThreadingHTTPServer(("0.0.0.0", port), Handler)
print(f"Contracts VM server on :{port}, db={DB_CONFIG['dbname']}") print(f"Contracts VM server on :{port}, db={DB_CONFIG['dbname']}")