fix: eliminate 40s message delivery delay caused by libsignal console dumps

fix: eliminate 40s message delivery delay caused by libsignal console dumps
This commit is contained in:
Renato Alcara
2026-02-27 08:43:54 -03:00
committed by GitHub
parent efc927728b
commit d233a7856f
18 changed files with 359 additions and 277 deletions
+4 -3
View File
@@ -321,7 +321,7 @@ export const makeSocket = (config: SocketConfig) => {
} catch (error) {
// Catch timeout and return undefined instead of throwing
if (error instanceof Boom && error.output?.statusCode === DisconnectReason.timedOut) {
logger?.warn?.({ msgId }, 'timed out waiting for message')
logger?.debug?.({ msgId }, 'timed out waiting for message')
return undefined
}
@@ -1539,6 +1539,7 @@ export const makeSocket = (config: SocketConfig) => {
if (passiveResult.status === 'rejected') {
logger.warn({ err: passiveResult.reason }, 'failed to send initial passive iq')
}
for (const result of results.slice(1)) {
if (result.status === 'rejected') {
logger.warn({ err: result.reason }, 'background key operation failed after login (non-critical)')
@@ -1559,8 +1560,8 @@ export const makeSocket = (config: SocketConfig) => {
// for the same storage locks while the offline-message backlog is draining.
// start() is idempotent (guarded by cleanupInterval check) so deferring is safe.
const _cleanupStartTimer = setTimeout(() => sessionCleanup.start(), 5_000)
if (typeof (_cleanupStartTimer as NodeJS.Timeout).unref === 'function') {
;(_cleanupStartTimer as NodeJS.Timeout).unref()
if (typeof _cleanupStartTimer.unref === 'function') {
_cleanupStartTimer.unref()
}
// Start session activity tracker immediately (lightweight, no DB scan)