Skip to content

Commit 7449102

Browse files
committed
fix: Recovering messages lost with redis cache
1 parent 234a2c7 commit 7449102

File tree

3 files changed

+6
-111
lines changed

3 files changed

+6
-111
lines changed

src/api/services/whatsapp/whatsapp.baileys.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class BaileysStartupService extends WAStartupService {
151151
const cacheConf = this.configService.get<CacheConf>('CACHE');
152152

153153
if ((cacheConf?.REDIS?.ENABLED && cacheConf?.REDIS?.URI !== '') || cacheConf?.LOCAL?.ENABLED) {
154-
setTimeout(async () => {
154+
setInterval(async () => {
155155
this.logger.info('Recovering messages');
156156
this.messagesLostCache.keys().then((keys) => {
157157
keys.forEach(async (key) => {

src/cache/cacheengine.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { ICache } from '../api/abstract/abstract.cache';
22
import { CacheConf, ConfigService } from '../config/env.config';
3+
import { Logger } from '../config/logger.config';
34
import { LocalCache } from './localcache';
45
import { RedisCache } from './rediscache';
56

7+
const logger = new Logger('Redis');
8+
69
export class CacheEngine {
710
private engine: ICache;
811

@@ -14,6 +17,8 @@ export class CacheEngine {
1417
} else if (cacheConf?.LOCAL?.ENABLED) {
1518
this.engine = new LocalCache(configService, module);
1619
}
20+
21+
logger.info(`RedisCache initialized for ${module}`);
1722
}
1823

1924
public getEngine() {

views/manager-wip.hbs

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)