backend: Filter out egress with status ENDING from the active egress list

This commit is contained in:
Carlos Santos 2025-03-28 10:26:15 +01:00
parent f3dfb9769f
commit 6fb353b6b4

View File

@ -5,6 +5,7 @@ import {
DataPacket_Kind, DataPacket_Kind,
EgressClient, EgressClient,
EgressInfo, EgressInfo,
EgressStatus,
EncodedFileOutput, EncodedFileOutput,
ListEgressOptions, ListEgressOptions,
ParticipantInfo, ParticipantInfo,
@ -208,7 +209,12 @@ export class LiveKitService {
egressId, egressId,
active: true active: true
}; };
return await this.egressClient.listEgress(options); const egress = await this.egressClient.listEgress(options);
// In some cases, the egress list may contain egress that their status is ENDINDG
// which means that the egress is still active but it is in the process of stopping.
// We need to filter those out.
return egress.filter((e) => e.status === EgressStatus.EGRESS_ACTIVE);
} catch (error: any) { } catch (error: any) {
if (error.message.includes('404')) { if (error.message.includes('404')) {
return []; return [];