mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-13 15:14:49 -06:00
Implemented an option to toggle temp instances deletion
This commit is contained in:
parent
499bd4328a
commit
a6adbd61db
@ -16,6 +16,7 @@ LOG_BAILEYS=error
|
||||
# Default time: 5 minutes
|
||||
# If you don't even want an expiration, enter the value false
|
||||
DEL_INSTANCE=false
|
||||
DEL_TEMP_INSTANCES=true # Delete instances with status closed on start
|
||||
|
||||
# Temporary data storage
|
||||
STORE_MESSAGES=true
|
||||
|
@ -16,6 +16,7 @@ LOG_BAILEYS=error
|
||||
# Default time: 5 minutes
|
||||
# If you don't even want an expiration, enter the value false
|
||||
DEL_INSTANCE=false
|
||||
DEL_TEMP_INSTANCES=true # Delete instances with status closed on start
|
||||
|
||||
# Temporary data storage
|
||||
STORE_MESSAGES=true
|
||||
|
@ -35,6 +35,7 @@ ENV LOG_COLOR=true
|
||||
ENV LOG_BAILEYS=error
|
||||
|
||||
ENV DEL_INSTANCE=false
|
||||
ENV DEL_TEMP_INSTANCES=true
|
||||
|
||||
ENV STORE_MESSAGES=true
|
||||
ENV STORE_MESSAGE_UP=true
|
||||
|
@ -189,6 +189,7 @@ export interface Env {
|
||||
WA_BUSINESS: WaBusiness;
|
||||
LOG: Log;
|
||||
DEL_INSTANCE: DelInstance;
|
||||
DEL_TEMP_INSTANCES: boolean;
|
||||
LANGUAGE: Language;
|
||||
WEBHOOK: Webhook;
|
||||
CONFIG_SESSION_PHONE: ConfigSessionPhone;
|
||||
@ -317,6 +318,9 @@ export class ConfigService {
|
||||
DEL_INSTANCE: isBooleanString(process.env?.DEL_INSTANCE)
|
||||
? process.env.DEL_INSTANCE === 'true'
|
||||
: Number.parseInt(process.env.DEL_INSTANCE) || false,
|
||||
DEL_TEMP_INSTANCES: isBooleanString(process.env?.DEL_TEMP_INSTANCES)
|
||||
? process.env.DEL_TEMP_INSTANCES === 'true'
|
||||
: true,
|
||||
LANGUAGE: process.env?.LANGUAGE || 'en',
|
||||
WEBHOOK: {
|
||||
GLOBAL: {
|
||||
|
@ -47,6 +47,7 @@ LOG:
|
||||
# Default time: 5 minutes
|
||||
# If you don't even want an expiration, enter the value false
|
||||
DEL_INSTANCE: false # or false
|
||||
DEL_TEMP_INSTANCES: true # Delete instances with status closed on start
|
||||
|
||||
# Temporary data storage
|
||||
STORE:
|
||||
|
@ -480,6 +480,11 @@ export class WAMonitoringService {
|
||||
}
|
||||
|
||||
private async deleteTempInstances(collections: Collection<Document>[]) {
|
||||
const shouldDelete = this.configService.get<boolean>('DEL_TEMP_INSTANCES');
|
||||
if (!shouldDelete) {
|
||||
this.logger.verbose('Temp instances deletion is disabled');
|
||||
return;
|
||||
}
|
||||
this.logger.verbose('Cleaning up temp instances');
|
||||
const auths = await this.repository.auth.list();
|
||||
if (auths.length === 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user