Skip to content

Commit b96ae12

Browse files
committed
Handle ratelimiting for non-legacy state setting
Each request must be retried, as the non-legacy flow involves a sequence of requests that must resolve in order.
1 parent 473c3cc commit b96ae12

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/matrixrtc/MatrixRTCSession.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,11 +1049,8 @@ export class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSessionEvent, M
10491049
};
10501050
await prepareDelayedDisconnection();
10511051
// Send join event _after_ preparing the delayed disconnection event
1052-
await this.client.sendStateEvent(
1053-
this.room.roomId,
1054-
EventType.GroupCallMemberPrefix,
1055-
newContent,
1056-
stateKey,
1052+
await resendIfRateLimited(() =>
1053+
this.client.sendStateEvent(this.room.roomId, EventType.GroupCallMemberPrefix, newContent, stateKey),
10571054
);
10581055
// If sending state cancels your own delayed state, prepare another delayed state
10591056
// TODO: Remove this once MSC4140 is stable & doesn't cancel own delayed state
@@ -1093,11 +1090,13 @@ export class MatrixRTCSession extends TypedEventEmitter<MatrixRTCSessionEvent, M
10931090
this.disconnectDelayId = undefined;
10941091
}
10951092
if (!sentDelayedDisconnect) {
1096-
await this.client.sendStateEvent(
1097-
this.room.roomId,
1098-
EventType.GroupCallMemberPrefix,
1099-
{},
1100-
this.makeMembershipStateKey(localUserId, localDeviceId),
1093+
await resendIfRateLimited(() =>
1094+
this.client.sendStateEvent(
1095+
this.room.roomId,
1096+
EventType.GroupCallMemberPrefix,
1097+
{},
1098+
this.makeMembershipStateKey(localUserId, localDeviceId),
1099+
),
11011100
);
11021101
}
11031102
}

0 commit comments

Comments
 (0)