perf(chatwoot): create cache for the most used/expensive functions in chatwoot

This commit is contained in:
jaison-x
2024-01-03 18:42:54 -03:00
parent 7373eea842
commit f376047632
5 changed files with 102 additions and 2 deletions

View File

@@ -368,6 +368,8 @@ export class WAStartupService {
Object.assign(this.localChatwoot, { ...data, sign_delimiter: data.sign_msg ? data.sign_delimiter : null });
this.clearCacheChatwoot();
this.logger.verbose('Chatwoot set');
}
@@ -402,6 +404,14 @@ export class WAStartupService {
};
}
public clearCacheChatwoot() {
this.logger.verbose('Removing cache from chatwoot');
if (this.localChatwoot.enabled) {
this.chatwootService.getCache().deleteAll();
}
}
private async loadSettings() {
this.logger.verbose('Loading settings');
const data = await this.repository.settings.find(this.instanceName);