mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-16 04:02:54 -06:00
feat: Re-enable group metadata caching in Baileys service
- Restore group metadata caching mechanisms - Uncomment cache-related methods for group updates and participants - Implement conditional group metadata retrieval based on cache configuration
This commit is contained in:
parent
4a5d7a91e2
commit
3c2ea5c67c
@ -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,10 +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');
|
// group = await this.findGroup({ groupJid: sender }, 'inner');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NotFoundException('Group not found');
|
throw new NotFoundException('Group not found');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user