From 1a975fe61ba2c702c3de804d02b2ae78043179e4 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Fri, 15 Aug 2025 07:49:27 -0700 Subject: [PATCH] Fix `sleep()` during background throttling --- ts/textsecure/SocketManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/textsecure/SocketManager.ts b/ts/textsecure/SocketManager.ts index 942b9e018e..f08dc7666f 100644 --- a/ts/textsecure/SocketManager.ts +++ b/ts/textsecure/SocketManager.ts @@ -13,6 +13,7 @@ import type { connection as WebSocket } from 'websocket'; import qs from 'querystring'; import EventListener from 'events'; import type { IncomingMessage } from 'http'; +import { setTimeout as sleep } from 'node:timers/promises'; import type { AbortableProcess } from '../util/AbortableProcess'; import { strictAssert } from '../util/assert'; @@ -23,7 +24,6 @@ import { FIBONACCI_TIMEOUTS, } from '../util/BackOff'; import * as durations from '../util/durations'; -import { sleep } from '../util/sleep'; import { drop } from '../util/drop'; import type { ProxyAgent } from '../util/createProxyAgent'; import { createProxyAgent } from '../util/createProxyAgent'; @@ -280,7 +280,7 @@ export class SocketManager extends EventListener { this.#reconnectController = reconnectController; try { - await sleep(timeout, reconnectController.signal); + await sleep(timeout, undefined, { signal: reconnectController.signal }); } catch { log.info('reconnect canceled'); return;