From 2a9412c81adb79c0f4b441d92d3c03bc8d1a48c2 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Wed, 12 Jun 2024 19:02:36 -0300 Subject: [PATCH] chore: adjust socket configuration and update baileys version Updated package.json to include the latest version of baileys for improved functionality. Modified whatsapp.baileys.service.ts to adjust socket configuration, enhancing the stability and performance of the service. --- package.json | 2 +- .../channels/whatsapp.baileys.service.ts | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index bcd187d5..8ee94b3e 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "amqplib": "^0.10.3", "@aws-sdk/client-sqs": "^3.569.0", "axios": "^1.6.5", - "@whiskeysockets/baileys": "6.7.4", + "@whiskeysockets/baileys": "6.7.5", "class-validator": "^0.14.1", "compression": "^1.7.4", "cors": "^2.8.5", diff --git a/src/api/services/channels/whatsapp.baileys.service.ts b/src/api/services/channels/whatsapp.baileys.service.ts index 902eefde..210dc72b 100644 --- a/src/api/services/channels/whatsapp.baileys.service.ts +++ b/src/api/services/channels/whatsapp.baileys.service.ts @@ -595,9 +595,12 @@ export class BaileysStartupService extends ChannelStartupService { browser: number ? ['Chrome (Linux)', session.NAME, release()] : browser, version, markOnlineOnConnect: this.localSettings.always_online, - 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) => { @@ -614,7 +617,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 === @@ -770,12 +773,16 @@ export class BaileysStartupService extends ChannelStartupService { }, logger: P({ level: this.logBaileys }), printQRInTerminal: false, + mobile: this.mobile, browser: this.phoneNumber ? ['Chrome (Linux)', session.NAME, release()] : browser, version, markOnlineOnConnect: this.localSettings.always_online, - 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) => { @@ -792,7 +799,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 ===