mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-23 04:22:02 -06:00
Merge pull request #758 from judsonjuniorr/v2-instance-cleanup
Remove instance from redis even if using database
This commit is contained in:
commit
7f83263b63
@ -120,6 +120,7 @@ export class WAMonitoringService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async cleaningUp(instanceName: string) {
|
public async cleaningUp(instanceName: string) {
|
||||||
|
let instanceDbId: string;
|
||||||
if (this.db.ENABLED && this.db.SAVE_DATA.INSTANCE) {
|
if (this.db.ENABLED && this.db.SAVE_DATA.INSTANCE) {
|
||||||
const instance = await this.prismaRepository.instance.update({
|
const instance = await this.prismaRepository.instance.update({
|
||||||
where: { name: instanceName },
|
where: { name: instanceName },
|
||||||
@ -130,13 +131,15 @@ export class WAMonitoringService {
|
|||||||
|
|
||||||
rmSync(join(INSTANCE_DIR, instance.id), { recursive: true, force: true });
|
rmSync(join(INSTANCE_DIR, instance.id), { recursive: true, force: true });
|
||||||
|
|
||||||
|
instanceDbId = instance.id;
|
||||||
await this.prismaRepository.session.deleteMany({ where: { sessionId: instance.id } });
|
await this.prismaRepository.session.deleteMany({ where: { sessionId: instance.id } });
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.redis.REDIS.ENABLED && this.redis.REDIS.SAVE_INSTANCES) {
|
if (this.redis.REDIS.ENABLED && this.redis.REDIS.SAVE_INSTANCES) {
|
||||||
await this.cache.delete(instanceName);
|
await this.cache.delete(instanceName);
|
||||||
return;
|
if (instanceDbId) {
|
||||||
|
await this.cache.delete(instanceDbId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.providerSession?.ENABLED) {
|
if (this.providerSession?.ENABLED) {
|
||||||
|
Loading…
Reference in New Issue
Block a user