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,
EgressClient,
EgressInfo,
EgressStatus,
EncodedFileOutput,
ListEgressOptions,
ParticipantInfo,
@ -208,7 +209,12 @@ export class LiveKitService {
egressId,
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) {
if (error.message.includes('404')) {
return [];