important-judge-78504
10/07/2025, 9:07 PMtall-airline-16756
10/07/2025, 9:07 PMtall-airline-16756
10/07/2025, 9:07 PMSIGTERM signal, it gracefully stops accepting new job requests by entering a "draining" state. This lets the LiveKit server know not to assign any new jobs. Any job requests that come in before the server fully acknowledges this status will be automatically rejected. But don’t worry—any jobs already in progress will be allowed to finish normally, and the worker stays active until all sessions wrap up or the drain_timeout is reached.
Also, if you’re using a custom request_fnc, it won’t change this behavior. The request_fnc is used during regular operations to decide whether to accept or reject jobs. Once the SIGTERM signal is received, the worker skips over the request_fnc and goes straight into the draining state. This helps ensure a smooth and safe shutdown process.
If anything is unclear or if you have more questions, please don’t hesitate to ask—I’m here to help!
Sources: agents/src/cli.ts | Deploying to custom environments | LiveKit Docs | Worker options | LiveKit Docsimportant-judge-78504
10/07/2025, 9:20 PMtall-airline-16756
10/07/2025, 9:20 PMSIGTERM signal. At this stage, it stops taking on new jobs and focuses on finishing any active ones, so nothing gets interrupted unexpectedly.
Also, if the drain_timeout is set to 0, the worker will patiently wait for all current jobs to complete before shutting down. This helps ensure no active sessions are cut off, though it might mean the shutdown takes longer if jobs run over time.
If you have any questions or need a hand with this, just let me know—I’m here to help!
Sources: Worker lifecycle | LiveKit Docs | livekit-agents/livekit/agents/worker.py | README.md | Worker options | LiveKit Docs | Deploying to custom environments | LiveKit Docsimportant-judge-78504
10/07/2025, 9:45 PMtall-airline-16756
10/07/2025, 9:45 PMdrain_timeout=0 set. What’s likely happening is that your worker is running in development mode. In this mode, graceful draining is turned off, so the worker stops right away when it gets a termination signal, even if there are still active jobs. This is actually helpful for quick restarts and debugging while developing.
To make sure your worker waits for active calls to finish before shutting down, you’ll want to run it in production mode (not development mode) and set drain_timeout to a suitable non-zero value. If you'd like, I’m here to help you check or update your configuration—just let me know!
Sources: livekit-agents/livekit/agents/utils/connection_pool.pytall-airline-16756
10/07/2025, 9:54 PM