mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Logging improvements for sessions
This commit is contained in:
@@ -249,8 +249,6 @@ export class SignalProtocolStore extends EventEmitter {
|
|||||||
|
|
||||||
sessionQueues = new Map<SessionIdType, PQueue>();
|
sessionQueues = new Map<SessionIdType, PQueue>();
|
||||||
|
|
||||||
sessionQueueJobCounter = 0;
|
|
||||||
|
|
||||||
readonly #identityQueues = new Map<ServiceIdString, PQueue>();
|
readonly #identityQueues = new Map<ServiceIdString, PQueue>();
|
||||||
#currentZone?: Zone;
|
#currentZone?: Zone;
|
||||||
#currentZoneDepth = 0;
|
#currentZoneDepth = 0;
|
||||||
@@ -991,29 +989,13 @@ export class SignalProtocolStore extends EventEmitter {
|
|||||||
|
|
||||||
async enqueueSessionJob<T>(
|
async enqueueSessionJob<T>(
|
||||||
qualifiedAddress: QualifiedAddress,
|
qualifiedAddress: QualifiedAddress,
|
||||||
name: string,
|
|
||||||
task: () => Promise<T>,
|
task: () => Promise<T>,
|
||||||
zone: Zone = GLOBAL_ZONE
|
zone: Zone = GLOBAL_ZONE
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
this.sessionQueueJobCounter += 1;
|
|
||||||
const id = this.sessionQueueJobCounter;
|
|
||||||
|
|
||||||
const waitStart = Date.now();
|
|
||||||
|
|
||||||
return this.withZone(zone, 'enqueueSessionJob', async () => {
|
return this.withZone(zone, 'enqueueSessionJob', async () => {
|
||||||
const queue = this.#_getSessionQueue(qualifiedAddress);
|
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>(() => {
|
return queue.add<T>(() => {
|
||||||
const queueTime = Date.now() - queueStart;
|
|
||||||
log.info(
|
|
||||||
`enqueueSessionJob(${id}): running task ${name}, waited ${queueTime}ms`
|
|
||||||
);
|
|
||||||
return task();
|
return task();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1593,7 +1575,6 @@ export class SignalProtocolStore extends EventEmitter {
|
|||||||
|
|
||||||
await this.enqueueSessionJob(
|
await this.enqueueSessionJob(
|
||||||
addr,
|
addr,
|
||||||
`_archiveSession(${addr.toString()})`,
|
|
||||||
async () => {
|
async () => {
|
||||||
const item = entry.hydrated ? entry.item : hydrateSession(entry.fromDB);
|
const item = entry.hydrated ? entry.item : hydrateSession(entry.fromDB);
|
||||||
|
|
||||||
|
|||||||
@@ -1798,7 +1798,6 @@ export default class MessageReceiver
|
|||||||
);
|
);
|
||||||
const unsealedPlaintext = await this.#storage.protocol.enqueueSessionJob(
|
const unsealedPlaintext = await this.#storage.protocol.enqueueSessionJob(
|
||||||
address,
|
address,
|
||||||
`sealedSenderDecryptMessage(${address.toString()})`,
|
|
||||||
() =>
|
() =>
|
||||||
sealedSenderDecryptMessage(
|
sealedSenderDecryptMessage(
|
||||||
Buffer.from(ciphertext),
|
Buffer.from(ciphertext),
|
||||||
@@ -1893,7 +1892,6 @@ export default class MessageReceiver
|
|||||||
|
|
||||||
const plaintext = await this.#storage.protocol.enqueueSessionJob(
|
const plaintext = await this.#storage.protocol.enqueueSessionJob(
|
||||||
address,
|
address,
|
||||||
`signalDecrypt(${address.toString()})`,
|
|
||||||
async () =>
|
async () =>
|
||||||
this.#unpad(
|
this.#unpad(
|
||||||
await signalDecrypt(
|
await signalDecrypt(
|
||||||
@@ -1925,7 +1923,6 @@ export default class MessageReceiver
|
|||||||
|
|
||||||
const plaintext = await this.#storage.protocol.enqueueSessionJob(
|
const plaintext = await this.#storage.protocol.enqueueSessionJob(
|
||||||
address,
|
address,
|
||||||
`signalDecryptPreKey(${address.toString()})`,
|
|
||||||
async () =>
|
async () =>
|
||||||
this.#unpad(
|
this.#unpad(
|
||||||
await signalDecryptPreKey(
|
await signalDecryptPreKey(
|
||||||
|
|||||||
@@ -445,7 +445,6 @@ export default class OutgoingMessage {
|
|||||||
|
|
||||||
return window.textsecure.storage.protocol.enqueueSessionJob<MessageType>(
|
return window.textsecure.storage.protocol.enqueueSessionJob<MessageType>(
|
||||||
address,
|
address,
|
||||||
`doSendMessage(${address.toString()}, ${this.timestamp})`,
|
|
||||||
async () => {
|
async () => {
|
||||||
const protocolAddress = ProtocolAddress.new(
|
const protocolAddress = ProtocolAddress.new(
|
||||||
serviceId,
|
serviceId,
|
||||||
@@ -641,7 +640,7 @@ export default class OutgoingMessage {
|
|||||||
) {
|
) {
|
||||||
newError = new OutgoingIdentityKeyError(serviceId, error);
|
newError = new OutgoingIdentityKeyError(serviceId, error);
|
||||||
log.error(
|
log.error(
|
||||||
'Got "key changed" error from encrypt - no identityKey for application layer',
|
'UntrustedIdentityKeyError from decrypt!',
|
||||||
serviceId,
|
serviceId,
|
||||||
deviceIds
|
deviceIds
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ async function handleServerKeys(
|
|||||||
try {
|
try {
|
||||||
await window.textsecure.storage.protocol.enqueueSessionJob(
|
await window.textsecure.storage.protocol.enqueueSessionJob(
|
||||||
address,
|
address,
|
||||||
`handleServerKeys(${serviceId})`,
|
|
||||||
() =>
|
() =>
|
||||||
processPreKeyBundle(
|
processPreKeyBundle(
|
||||||
preKeyBundle,
|
preKeyBundle,
|
||||||
|
|||||||
Reference in New Issue
Block a user