INNER CODE UNIT · Python

_artifact_payload

mars-tw/anti-gambling-trader-tw · core/ui/server.py:123

def _artifact_payload(artifact: Artifact) -> dict[str, str]:
    return {
        "id": artifact.id,
        "filename": artifact.filename,
        "media_type": artifact.media_type,
        "download_url": f"/api/artifact/{artifact.id}",
    }


class _OwnedHTTPServer(ThreadingHTTPServer):
    allow_reuse_address = False
    # Handler threads are deliberately non-daemon: request work must finish or
    # be explicitly interrupted by this server's own socket lifecycle.
    daemon_threads = False
    # ThreadingMixIn's default server_close() joins indefinitely.  We own a
    # bounded registry below instead, so a slow-drip client cannot make local
    # shutdown wait forever before it can close its socket.
    block_on_close = False

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…