fix: Fix the problem when disconnecting the instance and connecting again using mongodb

This commit is contained in:
Davidson Gomes 2023-12-19 14:55:16 -03:00
parent a869d38499
commit e8764dd1c6
3 changed files with 13 additions and 11 deletions

View File

@ -12,6 +12,7 @@
* Include instance Id field in the instance configuration
* Fixed the pairing code
* Adjusts in typebot
* Fix the problem when disconnecting the instance and connecting again using mongodb
# 1.6.0 (2023-12-12 17:24)

View File

@ -277,12 +277,6 @@ export class WAMonitoringService {
public async cleaningUp(instanceName: string) {
this.logger.verbose('cleaning up instance: ' + instanceName);
if (this.redis.ENABLED) {
this.logger.verbose('cleaning up instance in redis: ' + instanceName);
this.cache.reference = instanceName;
await this.cache.delAll();
return;
}
if (this.db.ENABLED && this.db.SAVE_DATA.INSTANCE) {
this.logger.verbose('cleaning up instance in database: ' + instanceName);
@ -294,6 +288,13 @@ export class WAMonitoringService {
return;
}
if (this.redis.ENABLED) {
this.logger.verbose('cleaning up instance in redis: ' + instanceName);
this.cache.reference = instanceName;
await this.cache.delAll();
return;
}
this.logger.verbose('cleaning up instance in files: ' + instanceName);
rmSync(join(INSTANCE_DIR, instanceName), { recursive: true, force: true });
}
@ -441,8 +442,8 @@ export class WAMonitoringService {
this.eventEmitter.on('logout.instance', async (instanceName: string) => {
this.logger.verbose('logout instance: ' + instanceName);
try {
// this.logger.verbose('request cleaning up instance: ' + instanceName);
// this.cleaningUp(instanceName);
this.logger.verbose('request cleaning up instance: ' + instanceName);
this.cleaningUp(instanceName);
} finally {
this.logger.warn(`Instance "${instanceName}" - LOGOUT`);
}

View File

@ -1387,7 +1387,7 @@ export class WAStartupService {
},
logger: P({ level: this.logBaileys }),
printQRInTerminal: false,
browser: ['Chrome (Linux)', session.NAME, release()],
browser: number ? ['Chrome (Linux)', session.NAME, release()] : browser,
version,
markOnlineOnConnect: this.localSettings.always_online,
retryRequestDelayMs: 10,
@ -1454,7 +1454,7 @@ export class WAStartupService {
const { version } = await fetchLatestBaileysVersion();
const session = this.configService.get<ConfigSessionPhone>('CONFIG_SESSION_PHONE');
// const browser: WABrowserDescription = [session.CLIENT, session.NAME, release()];
const browser: WABrowserDescription = [session.CLIENT, session.NAME, release()];
let options;
@ -1474,7 +1474,7 @@ export class WAStartupService {
},
logger: P({ level: this.logBaileys }),
printQRInTerminal: false,
browser: ['Chrome (Linux)', session.NAME, release()],
browser: this.phoneNumber ? ['Chrome (Linux)', session.NAME, release()] : browser,
version,
markOnlineOnConnect: this.localSettings.always_online,
retryRequestDelayMs: 10,