fix: Disable group metadata caching in Baileys service

- Remove group metadata caching mechanisms
- Modify group-related cache update methods
- Simplify group metadata retrieval process
This commit is contained in:
Davidson Gomes 2025-01-31 17:44:44 -03:00
parent 79b1c6bb1c
commit f8f1cbf4a2
2 changed files with 18 additions and 10 deletions

View File

@ -1,3 +1,10 @@
# 2.2.3 (develop)
### Fixed
* Fix cache in local file system
* Update Baileys Version
# 2.2.2 (2025-01-31 06:55)
### Features

View File

@ -668,7 +668,7 @@ export class BaileysStartupService extends ChannelStartupService {
shouldSyncHistoryMessage: (msg: proto.Message.IHistorySyncNotification) => {
return this.historySyncNotification(msg);
},
cachedGroupMetadata: this.getGroupMetadataCache,
// cachedGroupMetadata: this.getGroupMetadataCache,
userDevicesCache: this.userDevicesCache,
transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
patchMessageBeforeSending(message) {
@ -1562,11 +1562,11 @@ export class BaileysStartupService extends ChannelStartupService {
'groups.update': (groupMetadataUpdate: Partial<GroupMetadata>[]) => {
this.sendDataWebhook(Events.GROUPS_UPDATE, groupMetadataUpdate);
groupMetadataUpdate.forEach((group) => {
if (isJidGroup(group.id)) {
this.updateGroupMetadataCache(group.id);
}
});
// groupMetadataUpdate.forEach((group) => {
// if (isJidGroup(group.id)) {
// this.updateGroupMetadataCache(group.id);
// }
// });
},
'group-participants.update': (participantsUpdate: {
@ -1576,7 +1576,7 @@ export class BaileysStartupService extends ChannelStartupService {
}) => {
this.sendDataWebhook(Events.GROUP_PARTICIPANTS_UPDATE, participantsUpdate);
this.updateGroupMetadataCache(participantsUpdate.id);
// this.updateGroupMetadataCache(participantsUpdate.id);
},
};
@ -2160,9 +2160,10 @@ export class BaileysStartupService extends ChannelStartupService {
if (isJidGroup(sender)) {
let group;
try {
const cache = this.configService.get<CacheConf>('CACHE');
if (!cache.REDIS.ENABLED && !cache.LOCAL.ENABLED) group = await this.findGroup({ groupJid: sender }, 'inner');
else group = await this.getGroupMetadataCache(sender);
// const cache = this.configService.get<CacheConf>('CACHE');
// if (!cache.REDIS.ENABLED && !cache.LOCAL.ENABLED) group = await this.findGroup({ groupJid: sender }, 'inner');
// else group = await this.getGroupMetadataCache(sender);
group = await this.findGroup({ groupJid: sender }, 'inner');
} catch (error) {
throw new NotFoundException('Group not found');
}