1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Reduce console log spam (#3896)

* Reduce console log spam

A couple of different things:

 * Increase the `MaxListeners` setting on `MatrixClient` and `Thread`, so that
   we don't get "possible EventEmitter leak" warnings

 * Disable a couple of warnings/info lines that are just part of regular
   operation and are logged in large volumes.

* another noisy log line

* Reinstate warning about receipts for missing events

Apparently this is being worked on
This commit is contained in:
Richard van der Hoff
2023-11-20 18:17:06 +00:00
committed by GitHub
parent e98ce78027
commit 1889f8dad5
5 changed files with 10 additions and 8 deletions

View File

@@ -1494,6 +1494,9 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
this.ignoredInvites = new IgnoredInvites(this);
this._secretStorage = new ServerSideSecretStorageImpl(this, opts.cryptoCallbacks ?? {});
// having lots of event listeners is not unusual. 0 means "unlimited".
this.setMaxListeners(0);
}
public set store(newStore: Store) {

View File

@@ -143,6 +143,9 @@ export class Thread extends ReadReceipt<ThreadEmittedEvents, ThreadEventHandlerM
public constructor(public readonly id: string, public rootEvent: MatrixEvent | undefined, opts: IThreadOpts) {
super();
// each Event in the thread adds a reemitter, so we could hit the listener limit.
this.setMaxListeners(1000);
if (!opts?.room) {
// Logging/debugging for https://github.com/vector-im/element-web/issues/22141
// Hope is that we end up with a more obvious stack trace.

View File

@@ -64,12 +64,13 @@ export class RoomEncryptor {
// start tracking devices for any users already known to be in this room.
// Do not load members here, would defeat lazy loading.
const members = room.getJoinedMembers();
// At this point just mark the known members as tracked, it might not be the full list of members
// because of lazy loading. This is fine, because we will get a member list update when sending a message for
// the first time, see `RoomEncryptor#ensureEncryptionSession`
this.olmMachine.updateTrackedUsers(members.map((u) => new RustSdkCryptoJs.UserId(u.userId))).then(() => {
this.prefixedLogger.debug(`Updated tracked users for room ${room.roomId}`);
});
this.olmMachine
.updateTrackedUsers(members.map((u) => new RustSdkCryptoJs.UserId(u.userId)))
.catch((e) => this.prefixedLogger.error("Error initializing tracked users", e));
}
/**

View File

@@ -1560,10 +1560,6 @@ class EventDecryptor {
) {}
public async attemptEventDecryption(event: MatrixEvent): Promise<IEventDecryptionResult> {
this.logger.info(
`Attempting decryption of event ${event.getId()} in ${event.getRoomId()} from ${event.getSender()}`,
);
// add the event to the pending list *before* attempting to decrypt.
// then, if the key turns up while decryption is in progress (and
// decryption fails), we will schedule a retry.

View File

@@ -133,7 +133,6 @@ export class GroupCallEventHandler {
break;
}
logger.debug(`GroupCallEventHandler createGroupCallForRoom() processed room (roomId=${room.roomId})`);
this.getRoomDeferred(room.roomId).resolve!();
}