From f1c31a70bcc6d84ff14a55501db3ef7a3d39898a Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Wed, 12 Jun 2024 18:39:57 -0300 Subject: [PATCH] fix: adjust settings in whatsapp.baileys.service.ts Increased retryRequestDelayMs, added maxMsgRetryCount, and updated connectTimeoutMs and qrTimeout values for better performance. Adjusted transactionOpts for more efficient retries. These changes aim to enhance connection stability and message handling efficiency. --- .../channels/whatsapp.baileys.service.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/api/services/channels/whatsapp.baileys.service.ts b/src/api/services/channels/whatsapp.baileys.service.ts index 0f4d1d08a..efa5fc9e8 100644 --- a/src/api/services/channels/whatsapp.baileys.service.ts +++ b/src/api/services/channels/whatsapp.baileys.service.ts @@ -577,9 +577,12 @@ export class BaileysStartupService extends ChannelStartupService { browser: number ? ['Chrome (Linux)', session.NAME, release()] : browser, version, markOnlineOnConnect: this.localSettings.alwaysOnline, - retryRequestDelayMs: 10, - connectTimeoutMs: 60_000, - qrTimeout: 40_000, + retryRequestDelayMs: 350, + maxMsgRetryCount: 4, + fireInitQueries: true, + connectTimeoutMs: 20_000, + keepAliveIntervalMs: 30_000, + qrTimeout: 45_000, defaultQueryTimeoutMs: undefined, emitOwnEvents: false, shouldIgnoreJid: (jid) => { @@ -597,7 +600,7 @@ export class BaileysStartupService extends ChannelStartupService { return this.historySyncNotification(msg); }, userDevicesCache: this.userDevicesCache, - transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 10 }, + transactionOpts: { maxCommitRetries: 5, delayBetweenTriesMs: 2500 }, patchMessageBeforeSending(message) { if ( message.deviceSentMessage?.message?.listMessage?.listType === @@ -704,9 +707,12 @@ export class BaileysStartupService extends ChannelStartupService { browser: this.phoneNumber ? ['Chrome (Linux)', session.NAME, release()] : browser, version, markOnlineOnConnect: this.localSettings.alwaysOnline, - retryRequestDelayMs: 10, - connectTimeoutMs: 60_000, - qrTimeout: 40_000, + retryRequestDelayMs: 350, + maxMsgRetryCount: 4, + fireInitQueries: true, + connectTimeoutMs: 20_000, + keepAliveIntervalMs: 30_000, + qrTimeout: 45_000, defaultQueryTimeoutMs: undefined, emitOwnEvents: false, shouldIgnoreJid: (jid) => { @@ -724,7 +730,7 @@ export class BaileysStartupService extends ChannelStartupService { return this.historySyncNotification(msg); }, userDevicesCache: this.userDevicesCache, - transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 10 }, + transactionOpts: { maxCommitRetries: 5, delayBetweenTriesMs: 2500 }, patchMessageBeforeSending(message) { if ( message.deviceSentMessage?.message?.listMessage?.listType ===