Prepare authenticated lifecycle runtime and production release candidate
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a10780-6d41-7952-9718-dfbc1f41236f
This commit is contained in:
parent
f3b71b1521
commit
4f546ae3b1
41 changed files with 2598 additions and 52 deletions
|
|
@ -263,7 +263,25 @@ def main():
|
|||
readiness=runtime.pump.ready if runtime else lambda: False,
|
||||
lifecycle=runtime.lifecycle if runtime else None)
|
||||
try:
|
||||
serve(app, host=host, port=8080, threads=4)
|
||||
if runtime and runtime.workload:
|
||||
serve_with_workload(app, runtime.workload, host=host)
|
||||
else:
|
||||
serve(app, host=host, port=8080, threads=4)
|
||||
finally:
|
||||
if runtime:
|
||||
runtime.pump.stop()
|
||||
|
||||
|
||||
def serve_with_workload(public, private, *, host, public_port=8080, private_port=8081):
|
||||
"""Two sockets, one writer/process; the private app has no browser routes."""
|
||||
from waitress import create_server
|
||||
servers, socket_map = [], {}
|
||||
try:
|
||||
servers.append(create_server(public, host=host, port=public_port, threads=4, map=socket_map))
|
||||
servers.append(create_server(private, host=host, port=private_port, threads=4, map=socket_map,
|
||||
max_request_body_size=1024 * 1024))
|
||||
servers[0].run()
|
||||
finally:
|
||||
for server in servers:
|
||||
server.close()
|
||||
server.task_dispatcher.shutdown()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue