diff --git a/packages/backend/src/mag/rpc-client.ts b/packages/backend/src/mag/rpc-client.ts index 7b7f0dd452..002eb73c7e 100644 --- a/packages/backend/src/mag/rpc-client.ts +++ b/packages/backend/src/mag/rpc-client.ts @@ -26,7 +26,7 @@ async function getRpcClient(): Promise { } client = new Socket(); - client.setMaxListeners(1024); + client.setMaxListeners(10240); const [host, portStr] = config.rpcHost.trim().split(/:(?=[0-9]+$)/, 2); const port = parseInt(portStr); @@ -82,7 +82,7 @@ async function getRpcClient(): Promise { const data = buf.readBuffer(dataLen); dataDecoded = decode(data); } else { - dataDecoded = { success: false, data: "RPC returned failure" }; + dataDecoded = {success: false, data: "RPC returned failure"}; } // Move the rest of the data to the beginning of the buffer @@ -99,7 +99,7 @@ async function getRpcClient(): Promise { const reconnectWithBackoff = () => { client!.destroy(); client = new Socket(); - client.setMaxListeners(1024); + client.setMaxListeners(10240); setTimeout(() => createClient(client!), 1000 * (1 + Math.pow(1.5, exponentialBackoff))); }; @@ -139,7 +139,7 @@ async function rpcCall(method: string, data: D): Promise { client.off("error", clearAndReject); client.removeAllListeners(`mag-data:${currentSerial}`); reject(new Error("Promise timeout")) - }, 60000); + }, 75000); const clearAndReject = (e: any) => { clearTimeout(timeout); diff --git a/packages/backend/src/queue/index.ts b/packages/backend/src/queue/index.ts index f87c67daa8..dc67724ec2 100644 --- a/packages/backend/src/queue/index.ts +++ b/packages/backend/src/queue/index.ts @@ -171,7 +171,7 @@ export function deliver(user: ThinUser, content: unknown, to: string | null) { return deliverQueue.add(data, { attempts: config.deliverJobMaxAttempts || 12, - timeout: 60 * 1000, // 1min + timeout: 3 * 60 * 1000, // 3min backoff: { type: "apBackoff", },