Skip to content

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, raw_sockets, ssl_context, worker_id, max_connections, stream_queue_depth=64, ws_queue_depth=256)

Entry point executed in each worker process.

Parameters

app: The ASGI application callable (a BlackBull instance or any ASGI app). raw_sockets: Pre-bound socket objects inherited from the master via fork. ssl_context: TLS context to pass to asyncio.start_server, or None for plain HTTP. worker_id: Zero-based index used only for logging. max_connections: Per-worker connection limit; passed to ASGIServer.