Prepare compatible audit receiver with verified container lifecycle
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a07ff8-19d0-7820-b4d0-1353833cb7fc
This commit is contained in:
parent
f1b0577095
commit
cb23dc82fd
8 changed files with 426 additions and 17 deletions
|
|
@ -643,10 +643,21 @@ def serve(app, host: str, port: int, threads: int, timeout: int) -> None:
|
|||
return
|
||||
|
||||
log.info("serving on waitress host=%s port=%s threads=%s", host, port, threads)
|
||||
waitress_serve(
|
||||
app, host=host, port=port, threads=threads,
|
||||
channel_timeout=timeout, ident="audit-core",
|
||||
)
|
||||
# PID 1 ignores the default SIGTERM disposition. Raising SystemExit lets
|
||||
# Waitress stop its dispatcher and wait for active workers (bounded by its
|
||||
# shutdown timeout). A sender without an acknowledgement must still retry
|
||||
# the same event id; shutdown never substitutes for durable acceptance.
|
||||
def terminate(signum, frame):
|
||||
raise SystemExit(0)
|
||||
|
||||
previous = signal.signal(signal.SIGTERM, terminate)
|
||||
try:
|
||||
waitress_serve(
|
||||
app, host=host, port=port, threads=threads,
|
||||
channel_timeout=timeout, ident="audit-core",
|
||||
)
|
||||
finally:
|
||||
signal.signal(signal.SIGTERM, previous)
|
||||
|
||||
|
||||
def _serve_fallback(app, host: str, port: int, timeout: int) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue