Skip to content

Commit f8f1cbf

Browse files
committedJan 31, 2025
fix: Disable group metadata caching in Baileys service
- Remove group metadata caching mechanisms - Modify group-related cache update methods - Simplify group metadata retrieval process
1 parent 79b1c6b commit f8f1cbf

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed
 

‎CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 2.2.3 (develop)
2+
3+
### Fixed
4+
5+
* Fix cache in local file system
6+
* Update Baileys Version
7+
18
# 2.2.2 (2025-01-31 06:55)
29

310
### Features

‎src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

+11-10
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ export class BaileysStartupService extends ChannelStartupService {
668668
shouldSyncHistoryMessage: (msg: proto.Message.IHistorySyncNotification) => {
669669
return this.historySyncNotification(msg);
670670
},
671-
cachedGroupMetadata: this.getGroupMetadataCache,
671+
// cachedGroupMetadata: this.getGroupMetadataCache,
672672
userDevicesCache: this.userDevicesCache,
673673
transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
674674
patchMessageBeforeSending(message) {
@@ -1562,11 +1562,11 @@ export class BaileysStartupService extends ChannelStartupService {
15621562
'groups.update': (groupMetadataUpdate: Partial<GroupMetadata>[]) => {
15631563
this.sendDataWebhook(Events.GROUPS_UPDATE, groupMetadataUpdate);
15641564

1565-
groupMetadataUpdate.forEach((group) => {
1566-
if (isJidGroup(group.id)) {
1567-
this.updateGroupMetadataCache(group.id);
1568-
}
1569-
});
1565+
// groupMetadataUpdate.forEach((group) => {
1566+
// if (isJidGroup(group.id)) {
1567+
// this.updateGroupMetadataCache(group.id);
1568+
// }
1569+
// });
15701570
},
15711571

15721572
'group-participants.update': (participantsUpdate: {
@@ -1576,7 +1576,7 @@ export class BaileysStartupService extends ChannelStartupService {
15761576
}) => {
15771577
this.sendDataWebhook(Events.GROUP_PARTICIPANTS_UPDATE, participantsUpdate);
15781578

1579-
this.updateGroupMetadataCache(participantsUpdate.id);
1579+
// this.updateGroupMetadataCache(participantsUpdate.id);
15801580
},
15811581
};
15821582

@@ -2160,9 +2160,10 @@ export class BaileysStartupService extends ChannelStartupService {
21602160
if (isJidGroup(sender)) {
21612161
let group;
21622162
try {
2163-
const cache = this.configService.get<CacheConf>('CACHE');
2164-
if (!cache.REDIS.ENABLED && !cache.LOCAL.ENABLED) group = await this.findGroup({ groupJid: sender }, 'inner');
2165-
else group = await this.getGroupMetadataCache(sender);
2163+
// const cache = this.configService.get<CacheConf>('CACHE');
2164+
// if (!cache.REDIS.ENABLED && !cache.LOCAL.ENABLED) group = await this.findGroup({ groupJid: sender }, 'inner');
2165+
// else group = await this.getGroupMetadataCache(sender);
2166+
group = await this.findGroup({ groupJid: sender }, 'inner');
21662167
} catch (error) {
21672168
throw new NotFoundException('Group not found');
21682169
}

0 commit comments

Comments
 (0)
Please sign in to comment.