Skip to content

blackbull.server.worker

blackbull.server.worker

Forked worker entry point.

Create a fresh event loop, run lifespan per worker and leave SIGINT handling to the master. Workers handle its SIGTERM.

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 for accepted connections, or None for cleartext. 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.