You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
add comment to clarify how we avoid race
This commit is contained in:
@@ -781,6 +781,10 @@ MatrixClient.prototype.loadRoomMembersIfNeeded = async function(roomId) {
|
|||||||
if (!room || !room.needsOutOfBandMembers()) {
|
if (!room || !room.needsOutOfBandMembers()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Note that we don't await _loadMembers here first.
|
||||||
|
// setLazyLoadedMembers sets a flag before it awaits the promise passed in
|
||||||
|
// to avoid a race when calling membersNeedLoading/loadOutOfBandMembers
|
||||||
|
// in fast succession, before the first promise resolves.
|
||||||
const membersPromise = this._loadMembers(room);
|
const membersPromise = this._loadMembers(room);
|
||||||
await room.loadOutOfBandMembers(membersPromise);
|
await room.loadOutOfBandMembers(membersPromise);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user