Merge pull request #3110 from element-hq/robin/participant-limits
Show "insufficient capacity" when hitting participant limits
This commit is contained in:
@@ -22,11 +22,15 @@ import { GroupCallErrorBoundary } from "../room/GroupCallErrorBoundary.tsx";
|
|||||||
|
|
||||||
test.each<[string, ConnectionError]>([
|
test.each<[string, ConnectionError]>([
|
||||||
[
|
[
|
||||||
"LiveKit",
|
"LiveKit hits track limit",
|
||||||
new ConnectionError("", ConnectionErrorReason.InternalError, 503),
|
new ConnectionError("", ConnectionErrorReason.InternalError, 503),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"LiveKit Cloud",
|
"LiveKit hits room participant limit",
|
||||||
|
new ConnectionError("", ConnectionErrorReason.ServerUnreachable, 200),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"LiveKit Cloud hits connection limit",
|
||||||
new ConnectionError("", ConnectionErrorReason.NotAllowed, 429),
|
new ConnectionError("", ConnectionErrorReason.NotAllowed, 429),
|
||||||
],
|
],
|
||||||
])(
|
])(
|
||||||
|
|||||||
@@ -144,11 +144,16 @@ async function connectAndPublish(
|
|||||||
websocketTimeout: window.websocketTimeout ?? 45000,
|
websocketTimeout: window.websocketTimeout ?? 45000,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// LiveKit uses 503 to indicate that the server has hit its track limits
|
// LiveKit uses 503 to indicate that the server has hit its track limits.
|
||||||
// or equivalently, 429 in LiveKit Cloud
|
// https://github.com/livekit/livekit/blob/fcb05e97c5a31812ecf0ca6f7efa57c485cea9fb/pkg/service/rtcservice.go#L171
|
||||||
// For reference, the 503 response is generated at: https://github.com/livekit/livekit/blob/fcb05e97c5a31812ecf0ca6f7efa57c485cea9fb/pkg/service/rtcservice.go#L171
|
// It also errors with a status code of 200 (yes, really) for room
|
||||||
|
// participant limits.
|
||||||
if (e instanceof ConnectionError && (e.status === 503 || e.status === 429))
|
// LiveKit Cloud uses 429 for connection limits.
|
||||||
|
// Either way, all these errors can be explained as "insufficient capacity".
|
||||||
|
if (
|
||||||
|
e instanceof ConnectionError &&
|
||||||
|
(e.status === 503 || e.status === 200 || e.status === 429)
|
||||||
|
)
|
||||||
throw new InsufficientCapacityError();
|
throw new InsufficientCapacityError();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user