Only return null if there is no endpoint available.

This commit is contained in:
Timo K.
2026-10-15 12:42:36 +02:00
parent 1913a099ab
commit a427206792
@@ -72,14 +72,22 @@ export async function findRemotePublishLivekitTransport({
roomId, roomId,
slotId, slotId,
}); });
// The SFU treats an absent canPublish grant as publishing allowed. try {
if (decodeSFUJWTPayload(jwt).video.canPublish !== false) { // The SFU treats an absent canPublish grant as publishing allowed.
logger.info(`Publishing on remote SFU ${url} of ${serverName}`); if (decodeSFUJWTPayload(jwt).video.canPublish !== false) {
return { type: "livekit", url, server_name: serverName }; logger.info(`Publishing on remote SFU ${url} of ${serverName}`);
return { type: "livekit", url, server_name: serverName };
}
logger.info(
`${serverName} does not let us publish on ${url}, skipping`,
);
continue;
} catch (e) {
logger.info(
`${serverName}: failed to decode SFUJWT payload: ${e}, skipping`,
);
continue;
} }
logger.info(
`${serverName} does not let us publish on ${url}, skipping`,
);
} catch (e) { } catch (e) {
if (isCsApiUnavailable(e)) { if (isCsApiUnavailable(e)) {
// Without the endpoint no further candidate can work // Without the endpoint no further candidate can work
@@ -89,6 +97,7 @@ export async function findRemotePublishLivekitTransport({
return null; return null;
} }
logger.warn(`Failed to get a token for ${url} of ${serverName}:`, e); logger.warn(`Failed to get a token for ${url} of ${serverName}:`, e);
continue;
} }
} }
} }