Skip to content

Commit 1898d46

Browse files
matheusmartinsInspermatheusmartinsInsper
authored andcommitted
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 d3d9e33 commit 1898d46

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ export class BaileysStartupService extends ChannelStartupService {
546546
return isGroupJid || isBroadcast || isNewsletter;
547547
},
548548
syncFullHistory: this.localSettings.syncFullHistory,
549-
cachedGroupMetadata: this.getGroupMetadataCache,
549+
//cachedGroupMetadata: this.getGroupMetadataCache,
550550
userDevicesCache: this.userDevicesCache,
551551
transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
552552
patchMessageBeforeSending(message) {
@@ -1267,11 +1267,11 @@ export class BaileysStartupService extends ChannelStartupService {
12671267
'groups.update': (groupMetadataUpdate: Partial<GroupMetadata>[]) => {
12681268
this.sendDataWebhook(Events.GROUPS_UPDATE, groupMetadataUpdate);
12691269

1270-
groupMetadataUpdate.forEach((group) => {
1271-
if (isJidGroup(group.id)) {
1272-
this.updateGroupMetadataCache(group.id);
1273-
}
1274-
});
1270+
// groupMetadataUpdate.forEach((group) => {
1271+
// if (isJidGroup(group.id)) {
1272+
// this.updateGroupMetadataCache(group.id);
1273+
// }
1274+
// });
12751275
},
12761276

12771277
'group-participants.update': (participantsUpdate: {
@@ -1281,7 +1281,7 @@ export class BaileysStartupService extends ChannelStartupService {
12811281
}) => {
12821282
this.sendDataWebhook(Events.GROUP_PARTICIPANTS_UPDATE, participantsUpdate);
12831283

1284-
this.updateGroupMetadataCache(participantsUpdate.id);
1284+
//this.updateGroupMetadataCache(participantsUpdate.id);
12851285
},
12861286
};
12871287

@@ -1830,9 +1830,10 @@ export class BaileysStartupService extends ChannelStartupService {
18301830
if (isJidGroup(sender)) {
18311831
let group;
18321832
try {
1833-
const cache = this.configService.get<CacheConf>('CACHE');
1834-
if (!cache.REDIS.ENABLED && !cache.LOCAL.ENABLED) group = await this.findGroup({ groupJid: sender }, 'inner');
1835-
else group = await this.getGroupMetadataCache(sender);
1833+
// const cache = this.configService.get<CacheConf>('CACHE');
1834+
// if (!cache.REDIS.ENABLED && !cache.LOCAL.ENABLED) group = await this.findGroup({ groupJid: sender }, 'inner');
1835+
// else group = await this.getGroupMetadataCache(sender);
1836+
group = await this.findGroup({ groupJid: sender }, 'inner');
18361837
} catch (error) {
18371838
throw new NotFoundException('Group not found');
18381839
}

0 commit comments

Comments
 (0)