chore: lint

This commit is contained in:
Rajeh Taher
2025-11-19 16:18:13 +02:00
parent 235d7ec6f6
commit 50d410d117
11 changed files with 34 additions and 101 deletions
+18 -18
View File
@@ -145,7 +145,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
logger.debug({ messageKey }, 'already requested resend')
return
} else {
placeholderResendCache.set(messageKey?.id!, true)
await placeholderResendCache.set(messageKey?.id!, true)
}
await delay(5000)
@@ -164,10 +164,10 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
peerDataOperationRequestType: proto.Message.PeerDataOperationRequestType.PLACEHOLDER_MESSAGE_RESEND
}
setTimeout(() => {
setTimeout(async () => {
if (placeholderResendCache.get(messageKey?.id!)) {
logger.debug({ messageKey }, 'PDO message without response after 15 seconds. Phone possibly offline')
placeholderResendCache.del(messageKey?.id!)
await placeholderResendCache.del(messageKey?.id!)
}
}, 15_000)
@@ -403,14 +403,14 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
// Use the new retry count for the rest of the logic
const key = `${msgId}:${msgKey?.participant}`
msgRetryCache.set(key, retryCount)
await msgRetryCache.set(key, retryCount)
} else {
// Fallback to old system
const key = `${msgId}:${msgKey?.participant}`
let retryCount = (await msgRetryCache.get<number>(key)) || 0
if (retryCount >= maxMsgRetryCount) {
logger.debug({ retryCount, msgId }, 'reached retry limit, clearing')
msgRetryCache.del(key)
await msgRetryCache.del(key)
return
}
@@ -1031,7 +1031,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
if (!ids[i]) continue
if (msg && (await willSendMessageAgain(ids[i], participant))) {
updateSendMessageAgainCount(ids[i], participant)
await updateSendMessageAgainCount(ids[i], participant)
const msgRelayOpts: MessageRelayOptions = { messageId: ids[i] }
if (sendToAll) {
@@ -1122,7 +1122,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
if (ids[0] && key.participant && (await willSendMessageAgain(ids[0], key.participant))) {
if (key.fromMe) {
try {
updateSendMessageAgainCount(ids[0], key.participant)
await updateSendMessageAgainCount(ids[0], key.participant)
logger.debug({ attrs, key }, 'recv retry request')
await sendMessagesAgain(key, ids, retryNode!)
} catch (error: unknown) {
@@ -1257,7 +1257,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
logger.debug(`[handleMessage] Attempting retry request for failed decryption`)
// Handle both pre-key and normal retries in single mutex
retryMutex.mutex(async () => {
await retryMutex.mutex(async () => {
try {
if (!ws.isOpen) {
logger.debug({ node }, 'Connection closed, skipping retry')
@@ -1499,7 +1499,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
const offlineNodeProcessor = makeOfflineNodeProcessor()
const processNode = (
const processNode = async (
type: MessageType,
node: BinaryNode,
identifier: string,
@@ -1510,31 +1510,31 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
if (isOffline) {
offlineNodeProcessor.enqueue(type, node)
} else {
processNodeWithBuffer(node, identifier, exec)
await processNodeWithBuffer(node, identifier, exec)
}
}
// recv a message
ws.on('CB:message', (node: BinaryNode) => {
processNode('message', node, 'processing message', handleMessage)
ws.on('CB:message', async (node: BinaryNode) => {
await processNode('message', node, 'processing message', handleMessage)
})
ws.on('CB:call', async (node: BinaryNode) => {
processNode('call', node, 'handling call', handleCall)
await processNode('call', node, 'handling call', handleCall)
})
ws.on('CB:receipt', node => {
processNode('receipt', node, 'handling receipt', handleReceipt)
ws.on('CB:receipt', async node => {
await processNode('receipt', node, 'handling receipt', handleReceipt)
})
ws.on('CB:notification', async (node: BinaryNode) => {
processNode('notification', node, 'handling notification', handleNotification)
await processNode('notification', node, 'handling notification', handleNotification)
})
ws.on('CB:ack,class:message', (node: BinaryNode) => {
handleBadAck(node).catch(error => onUnexpectedError(error, 'handling bad ack'))
})
ev.on('call', ([call]) => {
ev.on('call', async ([call]) => {
if (!call) {
return
}
@@ -1562,7 +1562,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
}
const protoMsg = proto.WebMessageInfo.fromObject(msg) as WAMessage
upsertMessage(protoMsg, call.offline ? 'append' : 'notify')
await upsertMessage(protoMsg, call.offline ? 'append' : 'notify')
}
})