mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
calculate the number of retries based on the /sync grace period and network_error_retry_ms
This commit is contained in:
@@ -778,6 +778,18 @@ export function enterRTCSession(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculates `maximumNetworkErrorRetryCount`. The connection is failed if EITHER:
|
||||||
|
// - The /sync loop is unresponsive for > `gracePeriod` ms.
|
||||||
|
// - A delayed leave event is emitted (configured with a `leaveDelay` ms period).
|
||||||
|
// Note: Use leaveDelay >> gracePeriod for delegated leave events.
|
||||||
|
const gracePeriod = Config.get().sync_disconnect_grace_period_ms ?? 10000;
|
||||||
|
const leaveDelay = matrixRtcSessionConfig?.delayed_leave_event_delay_ms ?? 10000;
|
||||||
|
const retryInterval = matrixRtcSessionConfig?.network_error_retry_ms ?? 1000;
|
||||||
|
|
||||||
|
// Math.min is used to account for the respective worst case: /sync not available or leave event emitted.
|
||||||
|
const maxWaitTime = Math.min(gracePeriod, leaveDelay);
|
||||||
|
const maximumNetworkErrorRetryCount = Math.ceil(maxWaitTime / retryInterval) + 1;
|
||||||
|
|
||||||
// Multi-sfu does not need a preferred foci list. just the focus that is actually used.
|
// Multi-sfu does not need a preferred foci list. just the focus that is actually used.
|
||||||
// TODO where/how do we track errors originating from the ongoing rtcSession?
|
// TODO where/how do we track errors originating from the ongoing rtcSession?
|
||||||
|
|
||||||
@@ -803,7 +815,7 @@ export function enterRTCSession(
|
|||||||
membershipEventExpiryMs:
|
membershipEventExpiryMs:
|
||||||
matrixRtcSessionConfig?.membership_event_expiry_ms,
|
matrixRtcSessionConfig?.membership_event_expiry_ms,
|
||||||
unstableSendStickyEvents: matrixRTCMode === MatrixRTCMode.Matrix_2_0,
|
unstableSendStickyEvents: matrixRTCMode === MatrixRTCMode.Matrix_2_0,
|
||||||
maximumNetworkErrorRetryCount: 60,
|
maximumNetworkErrorRetryCount: maximumNetworkErrorRetryCount,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user