fix(spark-analytics): use ThreadingHTTPServer to prevent probe starvation
Single-threaded HTTPServer blocked readiness probes during long NIM API calls (~30s), causing Kubernetes to flip the pod unhealthy until the request completed. ThreadingHTTPServer handles each request in its own thread so probes are never starved. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ data:
|
||||
import urllib.request
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
|
||||
PORT = int(os.environ.get("PORT", "8080"))
|
||||
|
||||
@@ -581,7 +581,7 @@ data:
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
server = HTTPServer(("0.0.0.0", PORT), Handler)
|
||||
server = ThreadingHTTPServer(("0.0.0.0", PORT), Handler)
|
||||
print(f"Listening on :{PORT} DB={DB_HOST}:{DB_PORT}/{DB_NAME} JDBC_URL={_url!r}", flush=True)
|
||||
server.serve_forever()
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user