flaky-hospital-13625
08/02/2025, 1:17 PMclose event, how to clean up early.tall-airline-16756
08/02/2025, 1:17 PMtall-airline-16756
08/02/2025, 1:18 PMclose event because the system includes a graceful shutdown mechanism. This allows for cleanup operations to complete before termination. By default, shutdown hooks are given up to 60 seconds to finish their tasks.
To clean up early, you can:
1. Register shutdown callbacks for your cleanup logic using ctx.add_shutdown_callback().
2. Trigger the cleanup process explicitly by calling ctx.shutdown() in your code.
3. Ensure that your cleanup operations complete within the default timeout period (60 seconds) or adjust the timeout in WorkerOptions if necessary.
Let me know if you need further clarification or examples!
Sources: Inside a session | LiveKit Docs | JobContext | LiveKit Agents | Job lifecycle | LiveKit Docs