mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-20 02:06:43 -06:00
fix: recovering messages
This commit is contained in:
parent
0ad3acaf07
commit
d45b7af3b6
@ -148,17 +148,17 @@ export class BaileysStartupService extends WAStartupService {
|
|||||||
public mobile: boolean;
|
public mobile: boolean;
|
||||||
|
|
||||||
private async recoveringMessages() {
|
private async recoveringMessages() {
|
||||||
|
this.logger.info('Recovering messages lost');
|
||||||
const cacheConf = this.configService.get<CacheConf>('CACHE');
|
const cacheConf = this.configService.get<CacheConf>('CACHE');
|
||||||
|
|
||||||
if ((cacheConf?.REDIS?.ENABLED && cacheConf?.REDIS?.URI !== '') || cacheConf?.LOCAL?.ENABLED) {
|
if ((cacheConf?.REDIS?.ENABLED && cacheConf?.REDIS?.URI !== '') || cacheConf?.LOCAL?.ENABLED) {
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
this.logger.info('Recovering messages');
|
|
||||||
this.messagesLostCache.keys().then((keys) => {
|
this.messagesLostCache.keys().then((keys) => {
|
||||||
keys.forEach(async (key) => {
|
keys.forEach(async (key) => {
|
||||||
const message = await this.messagesLostCache.get(key.split(':')[2]);
|
const message = await this.messagesLostCache.get(key.split(':')[2]);
|
||||||
|
|
||||||
if (message.messageStubParameters && message.messageStubParameters[0] === 'Message absent from node') {
|
if (message.messageStubParameters && message.messageStubParameters[0] === 'Message absent from node') {
|
||||||
this.logger.verbose('Message absent from node, retrying to send, key: ' + key.split(':')[2]);
|
this.logger.info('Message absent from node, retrying to send, key: ' + key.split(':')[2]);
|
||||||
await this.client.sendMessageAck(JSON.parse(message.messageStubParameters[1], BufferJSON.reviver));
|
await this.client.sendMessageAck(JSON.parse(message.messageStubParameters[1], BufferJSON.reviver));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user