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) # 2.2.2 (2025-01-31 06:55)
### Features ### Features

View File

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