Logging improvements for sessions

This commit is contained in:
Scott Nonnenberg
2025-04-23 02:18:14 +10:00
committed by GitHub
parent bd53f2891e
commit c530192236
4 changed files with 1 additions and 25 deletions

View File

@@ -249,8 +249,6 @@ export class SignalProtocolStore extends EventEmitter {
sessionQueues = new Map<SessionIdType, PQueue>();
sessionQueueJobCounter = 0;
readonly #identityQueues = new Map<ServiceIdString, PQueue>();
#currentZone?: Zone;
#currentZoneDepth = 0;
@@ -991,29 +989,13 @@ export class SignalProtocolStore extends EventEmitter {
async enqueueSessionJob<T>(
qualifiedAddress: QualifiedAddress,
name: string,
task: () => Promise<T>,
zone: Zone = GLOBAL_ZONE
): Promise<T> {
this.sessionQueueJobCounter += 1;
const id = this.sessionQueueJobCounter;
const waitStart = Date.now();
return this.withZone(zone, 'enqueueSessionJob', async () => {
const queue = this.#_getSessionQueue(qualifiedAddress);
const waitTime = Date.now() - waitStart;
log.info(
`enqueueSessionJob(${id}): queuing task ${name}, waited ${waitTime}ms`
);
const queueStart = Date.now();
return queue.add<T>(() => {
const queueTime = Date.now() - queueStart;
log.info(
`enqueueSessionJob(${id}): running task ${name}, waited ${queueTime}ms`
);
return task();
});
});
@@ -1593,7 +1575,6 @@ export class SignalProtocolStore extends EventEmitter {
await this.enqueueSessionJob(
addr,
`_archiveSession(${addr.toString()})`,
async () => {
const item = entry.hydrated ? entry.item : hydrateSession(entry.fromDB);