@@ -24,6 +24,9 @@ export const WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6])
|
||||
|
||||
export const WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60
|
||||
|
||||
/** Status messages older than 24 hours are considered expired */
|
||||
export const STATUS_EXPIRY_SECONDS = 24 * 60 * 60
|
||||
|
||||
export const NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0'
|
||||
export const DICT_VERSION = 3
|
||||
export const KEY_BUNDLE_TYPE = Buffer.from([5])
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Boom } from '@hapi/boom'
|
||||
import { randomBytes } from 'crypto'
|
||||
import Long from 'long'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import { DEFAULT_CACHE_TTLS, KEY_BUNDLE_TYPE, MIN_PREKEY_COUNT } from '../Defaults'
|
||||
import { DEFAULT_CACHE_TTLS, KEY_BUNDLE_TYPE, MIN_PREKEY_COUNT, STATUS_EXPIRY_SECONDS } from '../Defaults'
|
||||
import { metrics, recordMessageReceived, recordHistorySyncMessages, recordMessageRetry, recordMessageFailure } from '../Utils/prometheus-metrics.js'
|
||||
import type {
|
||||
GroupParticipant,
|
||||
@@ -1299,6 +1299,18 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
return sendMessageAck(node)
|
||||
}
|
||||
|
||||
// Skip retry for expired status messages (>24h old)
|
||||
if (isJidStatusBroadcast(msg.key.remoteJid!)) {
|
||||
const messageAge = unixTimestampSeconds() - toNumber(msg.messageTimestamp)
|
||||
if (messageAge > STATUS_EXPIRY_SECONDS) {
|
||||
logger.debug(
|
||||
{ msgId: msg.key.id, messageAge, remoteJid: msg.key.remoteJid },
|
||||
'skipping retry for expired status message'
|
||||
)
|
||||
return sendMessageAck(node)
|
||||
}
|
||||
}
|
||||
|
||||
const errorMessage = msg?.messageStubParameters?.[0] || ''
|
||||
const isPreKeyError = errorMessage.includes('PreKey')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user