blackbull.server.worker¶
blackbull.server.worker
¶
Worker process entry point for multi-worker deployments.
Each worker is a forked child that inherits pre-bound socket file descriptors from the master, creates a fresh asyncio event loop, and runs a standard ASGIServer with those sockets.
The worker
- ignores SIGINT (the master handles Ctrl+C and sends SIGTERM to workers)
- runs lifespan independently (startup/shutdown per worker)
- tracks active connections via the ASGIServer connection counter
run_worker(app, bound_listeners, ssl_context, worker_id, max_connections, stream_queue_depth=64, ws_queue_depth=_WS_READ_INLINE, disowned=())
¶
Entry point executed in each worker process.
Parameters¶
app:
The ASGI application callable (a BlackBull instance or any ASGI app).
bound_listeners:
[(Listener, [socket, ...]), ...] inherited from the master via
fork — every listener this worker owns, which the master decided from
each listener's own workers field.
ssl_context:
TLS context to pass to asyncio.start_server, or None for plain HTTP.
disowned:
Listening sockets this worker inherited through fork but does not
serve — another worker's, or a single-owner listener it does not own.
Closed on entry, in this process only: the master and the owning
worker keep their own descriptors.
worker_id:
Zero-based index used only for logging.
max_connections:
Per-worker connection limit; passed to ASGIServer.