You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
add logging, should be useful as long as not merged into develop
This commit is contained in:
@@ -767,6 +767,7 @@ MatrixClient.prototype._loadMembers = async function(room) {
|
|||||||
const lastEventId = room.getLastEventId();
|
const lastEventId = room.getLastEventId();
|
||||||
const response = await this.members(roomId, "join", "leave", lastEventId);
|
const response = await this.members(roomId, "join", "leave", lastEventId);
|
||||||
rawMembersEvents = response.chunk;
|
rawMembersEvents = response.chunk;
|
||||||
|
console.log(`LL: got ${rawMembersEvents.length} members from server`);
|
||||||
}
|
}
|
||||||
const memberEvents = rawMembersEvents.map(this.getEventMapper());
|
const memberEvents = rawMembersEvents.map(this.getEventMapper());
|
||||||
return {memberEvents, fromServer};
|
return {memberEvents, fromServer};
|
||||||
@@ -807,8 +808,12 @@ MatrixClient.prototype.loadRoomMembersIfNeeded = async function(roomId) {
|
|||||||
// scenario for DM's where all the members would likely
|
// scenario for DM's where all the members would likely
|
||||||
// be known without lazy loading.
|
// be known without lazy loading.
|
||||||
if (rawMembersEvents.length) {
|
if (rawMembersEvents.length) {
|
||||||
|
console.log(`LL: telling backend to store ${rawMembersEvents.length} members`);
|
||||||
await this.store.setOutOfBandMembers(roomId, rawMembersEvents);
|
await this.store.setOutOfBandMembers(roomId, rawMembersEvents);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
console.log(`LL: no members needed to be stored`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -432,9 +432,11 @@ RoomState.prototype.markOutOfBandMembersFailed = function() {
|
|||||||
* @param {MatrixEvent[]} stateEvents array of membership state events
|
* @param {MatrixEvent[]} stateEvents array of membership state events
|
||||||
*/
|
*/
|
||||||
RoomState.prototype.setOutOfBandMembers = function(stateEvents) {
|
RoomState.prototype.setOutOfBandMembers = function(stateEvents) {
|
||||||
|
console.log(`LL: RoomState about to set ${stateEvents.length} OOB members ...`);
|
||||||
if (this._oobMemberFlags.status !== OOB_STATUS_INPROGRESS) {
|
if (this._oobMemberFlags.status !== OOB_STATUS_INPROGRESS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log(`LL: RoomState put in OOB_STATUS_FINISHED state ...`);
|
||||||
this._oobMemberFlags.status = OOB_STATUS_FINISHED;
|
this._oobMemberFlags.status = OOB_STATUS_FINISHED;
|
||||||
stateEvents.forEach((e) => this._setOutOfBandMember(e));
|
stateEvents.forEach((e) => this._setOutOfBandMember(e));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -216,10 +216,14 @@ LocalIndexedDBStoreBackend.prototype = {
|
|||||||
request.onerror = (err) => {
|
request.onerror = (err) => {
|
||||||
reject(err);
|
reject(err);
|
||||||
};
|
};
|
||||||
|
}).then((membershipEvents) => {
|
||||||
|
console.log(`LL: got ${membershipEvents.length} membershipEvents from storage for room ${roomId} ...`);
|
||||||
|
return membershipEvents;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setOutOfBandMembers: function(roomId, membershipEvents) {
|
setOutOfBandMembers: function(roomId, membershipEvents) {
|
||||||
|
console.log(`LL: backend about to store ${membershipEvents.length} members for ${roomId}`);
|
||||||
function ignoreResult() {};
|
function ignoreResult() {};
|
||||||
// run everything in a promise so anything that throws will reject
|
// run everything in a promise so anything that throws will reject
|
||||||
return new Promise((resolve) =>{
|
return new Promise((resolve) =>{
|
||||||
@@ -230,6 +234,8 @@ LocalIndexedDBStoreBackend.prototype = {
|
|||||||
return putPromise.then(ignoreResult);
|
return putPromise.then(ignoreResult);
|
||||||
});
|
});
|
||||||
resolve(Promise.all(puts).then(ignoreResult));
|
resolve(Promise.all(puts).then(ignoreResult));
|
||||||
|
}).then(() => {
|
||||||
|
console.log(`LL: backend done storing for ${roomId}!`);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user