feat(livekit): close the room when a pod is deleted
DELETE /api/pods/:id now also calls closeRoom (RoomServiceClient.deleteRoom) to end the live LiveKit room and disconnect anyone connected. PodView listens for RoomEvent.Disconnected and returns the user to the pod list, so a deleted pod cleanly kicks everyone out instead of stranding them in a dead room. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,19 @@ function svc(): RoomServiceClient {
|
||||
return client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a pod's LiveKit room, disconnecting everyone. Best-effort: a missing/
|
||||
* already-empty room is fine. Called when a pod is deleted.
|
||||
*/
|
||||
export async function closeRoom(podId: string): Promise<void> {
|
||||
if (!isConfigured()) return;
|
||||
try {
|
||||
await svc().deleteRoom(podId);
|
||||
} catch (e) {
|
||||
console.warn(`[livekit] closeRoom ${podId} failed: ${(e as Error).message}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Who is currently connected in each pod's LiveKit room, as display names,
|
||||
* keyed by pod id (= room name). Empty rooms are omitted. Returns {} if
|
||||
|
||||
Reference in New Issue
Block a user