mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2026-01-09 05:12:28 -06:00
Durante o processo de logout de uma instância, as chaves associadas ao estado criptográfico não estavam sendo removidas corretamente do Redis.
Dessa forma, quando uma nova conexão era estabelecida reutilizando o mesmo instanceName, o Baileys carregava chaves antigas e inválidas, incompatíveis com o novo conjunto de credenciais (creds) gerado na reconexão. Essa inconsistência gerava o seguinte sintoma prático: A instância autenticava com sucesso; Contudo, ao tentar enviar mensagens, entrava em estado de bloqueio, exibindo o status “aguardando mensagem” indefinidamente.
This commit is contained in:
@@ -266,6 +266,28 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
|
||||
this.client?.ws?.close();
|
||||
|
||||
const db = this.configService.get<Database>('DATABASE');
|
||||
const cache = this.configService.get<CacheConf>('CACHE');
|
||||
const provider = this.configService.get<ProviderSession>('PROVIDER');
|
||||
|
||||
if (provider?.ENABLED) {
|
||||
const authState = await this.authStateProvider.authStateProvider(this.instance.id);
|
||||
|
||||
await authState.removeCreds()
|
||||
}
|
||||
|
||||
if (cache?.REDIS.ENABLED && cache?.REDIS.SAVE_INSTANCES) {
|
||||
const authState = await useMultiFileAuthStateRedisDb(this.instance.id, this.cache);
|
||||
|
||||
await authState.removeCreds()
|
||||
}
|
||||
|
||||
if (db.SAVE_DATA.INSTANCE) {
|
||||
const authState = await useMultiFileAuthStatePrisma(this.instance.id, this.cache);
|
||||
|
||||
await authState.removeCreds()
|
||||
}
|
||||
|
||||
const sessionExists = await this.prismaRepository.session.findFirst({ where: { sessionId: this.instanceId } });
|
||||
if (sessionExists) {
|
||||
await this.prismaRepository.session.delete({ where: { sessionId: this.instanceId } });
|
||||
|
||||
Reference in New Issue
Block a user