Skip to content

Commit e071f56

Browse files
committed
Merge branch 'release/2.3.9'
2 parents 371ec9b + c85619e commit e071f56

File tree

5 files changed

+28
-111
lines changed

5 files changed

+28
-111
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 1.7.4 (develop)
2+
3+
### Fixed
4+
* Adjusts in proxy on fetchAgent
5+
* Recovering messages lost with redis cache
6+
* Log when init redis cache service
7+
18
# 1.7.3 (2024-04-18 12:07)
29

310
### Fixed

src/api/models/message.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class MessageRaw {
3232
source_reply_id?: string;
3333
chatwoot?: ChatwootMessage;
3434
contextInfo?: any;
35+
status?: wa.StatusMessage | any;
3536
}
3637

3738
type MessageRawBoolean<T> = {

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

Lines changed: 15 additions & 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) => {
@@ -517,13 +517,15 @@ export class BaileysStartupService extends WAStartupService {
517517
const proxyUrl = 'http://' + proxyUrls[rand];
518518
options = {
519519
agent: makeProxyAgent(proxyUrl),
520+
fetchAgent: makeProxyAgent(proxyUrl),
520521
};
521522
} catch (error) {
522523
this.localProxy.enabled = false;
523524
}
524525
} else {
525526
options = {
526527
agent: makeProxyAgent(this.localProxy.proxy),
528+
fetchAgent: makeProxyAgent(this.localProxy.proxy),
527529
};
528530
}
529531
}
@@ -687,13 +689,15 @@ export class BaileysStartupService extends WAStartupService {
687689
const proxyUrl = 'http://' + proxyUrls[rand];
688690
options = {
689691
agent: makeProxyAgent(proxyUrl),
692+
fetchAgent: makeProxyAgent(proxyUrl),
690693
};
691694
} catch (error) {
692695
this.localProxy.enabled = false;
693696
}
694697
} else {
695698
options = {
696699
agent: makeProxyAgent(this.localProxy.proxy),
700+
fetchAgent: makeProxyAgent(this.localProxy.proxy),
697701
};
698702
}
699703
}
@@ -997,6 +1001,15 @@ export class BaileysStartupService extends WAStartupService {
9971001
continue;
9981002
}
9991003

1004+
const status: Record<number, wa.StatusMessage> = {
1005+
0: 'ERROR',
1006+
1: 'PENDING',
1007+
2: 'SERVER_ACK',
1008+
3: 'DELIVERY_ACK',
1009+
4: 'READ',
1010+
5: 'PLAYED',
1011+
};
1012+
10001013
messagesRaw.push({
10011014
key: m.key,
10021015
pushName: m.pushName || m.key.remoteJid.split('@')[0],
@@ -1005,6 +1018,7 @@ export class BaileysStartupService extends WAStartupService {
10051018
messageType: getContentType(m.message),
10061019
messageTimestamp: m.messageTimestamp as number,
10071020
owner: this.instance.name,
1021+
status: m.status ? status[m.status] : null,
10081022
});
10091023
}
10101024

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)