fix(lotus): a homeserver stall shorter than the delayed-leave window no longer ends the call (#46)
maximumNetworkErrorRetryCount was sized to min(sync grace period, leave delay), i.e. 10 s, so the membership manager gave up 20-35 s into a homeserver stall and showed "Connection lost", even when the server would keep the membership for 60 s (prod config). Size it to the leave delay instead: the embedded call has no /sync loop for the grace period to describe, and the server's delayed leave is what actually ends the membership. Fixes #46 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
58625c86b0
commit
a1dd0e254c
@@ -868,16 +868,19 @@ export function enterRTCSession(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculates `maximumNetworkErrorRetryCount`. The connection is failed if EITHER:
|
// Calculates `maximumNetworkErrorRetryCount`: enough retries to outlast the
|
||||||
// - The /sync loop is unresponsive for > `gracePeriod` ms, or
|
// server's delayed-leave window (see [lotus #46] below).
|
||||||
// - A delayed leave event is emitted (after `leaveDelay` ms period).
|
|
||||||
// Note: Use leaveDelay >> gracePeriod for delegated leave events.
|
|
||||||
const gracePeriod = Config.get().sync_disconnect_grace_period_ms;
|
const gracePeriod = Config.get().sync_disconnect_grace_period_ms;
|
||||||
const leaveDelay = matrixRtcSessionConfig?.delayed_leave_event_delay_ms;
|
const leaveDelay = matrixRtcSessionConfig?.delayed_leave_event_delay_ms;
|
||||||
const retryInterval = matrixRtcSessionConfig?.network_error_retry_ms;
|
const retryInterval = matrixRtcSessionConfig?.network_error_retry_ms;
|
||||||
|
|
||||||
// Math.min is used to account for the respective worst case: /sync not available or leave event emitted.
|
// [lotus #46] Keep retrying for as long as the homeserver itself would keep
|
||||||
const maxWaitTime = Math.min(gracePeriod, leaveDelay);
|
// our membership: until its delayed leave fires (`leaveDelay`). Capping at
|
||||||
|
// the 10 s sync grace period made a ~20–35 s homeserver stall end everyone's
|
||||||
|
// call ("Connection lost") even with a 60 s server-side leave delay. The
|
||||||
|
// embedded call has no /sync loop of its own, so the grace period doesn't
|
||||||
|
// describe anything it can observe.
|
||||||
|
const maxWaitTime = Math.max(gracePeriod, leaveDelay);
|
||||||
const maximumNetworkErrorRetryCount =
|
const maximumNetworkErrorRetryCount =
|
||||||
Math.ceil(maxWaitTime / retryInterval) + 1;
|
Math.ceil(maxWaitTime / retryInterval) + 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user