Skip to content

feat(ipc): allow configuring job entrypoint shutdown grace period (#6512) - #6674

Open
piyushrajyadav wants to merge 1 commit into
livekit:mainfrom
piyushrajyadav:fix/entrypoint-shutdown-timeout
Open

feat(ipc): allow configuring job entrypoint shutdown grace period (#6512)#6674
piyushrajyadav wants to merge 1 commit into
livekit:mainfrom
piyushrajyadav:fix/entrypoint-shutdown-timeout

Conversation

@piyushrajyadav

Copy link
Copy Markdown

Fixes #6512

Summary

When a worker process shuts down, _JobProc currently waits for the job entrypoint task for a hard-coded 15 seconds before cancelling it. Some applications need shutdown to terminate an active call immediately (e.g. entrypoint_shutdown_timeout=0.0) rather than allow voice playout or entrypoint tasks to drain for the full 15-second grace period.

This PR adds an entrypoint_shutdown_timeout: float = 15.0 parameter to ServerOptions and AgentServer, passing it down through ProcPool, ProcJobExecutor, ThreadJobExecutor, ProcStartArgs, ThreadStartArgs, to _JobProc.

Changes Made

  • worker.py: Added entrypoint_shutdown_timeout to ServerOptions and AgentServer.__init__, passed down in from_server_options and run().
  • proc_pool.py: Added entrypoint_shutdown_timeout to ProcPool.__init__, passed down to job executors.
  • job_proc_executor.py: Passed entrypoint_shutdown_timeout through process startup args.
  • job_thread_executor.py: Passed entrypoint_shutdown_timeout through thread startup args.
  • job_proc_lazy_main.py: Replaced hardcoded timeout=15 in _JobProc._run_job_task() with self._entrypoint_shutdown_timeout.
  • tests/test_entrypoint_shutdown_timeout.py: Added unit tests covering option propagation and fast entrypoint cancellation.

Test Plan

  • Ran unit tests: python -m pytest tests/test_entrypoint_shutdown_timeout.py --unit (2 passed)
  • Ran ruff check & ruff format

@piyushrajyadav
piyushrajyadav requested a review from a team as a code owner August 3, 2026 09:45
@CLAassistant

CLAassistant commented Aug 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

devin-ai-integration[bot]

This comment was marked as resolved.

@piyushrajyadav
piyushrajyadav force-pushed the fix/entrypoint-shutdown-timeout branch from f962ea2 to 4e88da7 Compare August 3, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow configuring the job entrypoint shutdown grace period

2 participants