feat: Mutex redesign - isolate event processing for better ordering and throughput (#2137)

* fix: improve message resend logic by adding checks for message IDs

* Revert "fix: improve message resend logic by adding checks for message IDs"

This reverts commit c03f9d8e6fc6cbfbb9d1f8f67c169700e704213d.

* fix: introduce separate mutexes for message, receipt, app state patch, and notification processing

* fix: remove unused processing mutex for notifications
This commit is contained in:
Matheus Filype
2025-12-11 23:34:59 -03:00
committed by GitHub
parent 8e93934eb7
commit 829fa8d601
3 changed files with 25 additions and 10 deletions
+2 -2
View File
@@ -71,7 +71,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
const {
ev,
authState,
processingMutex,
messageMutex,
signalRepository,
upsertMessage,
query,
@@ -1199,7 +1199,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
})
if (config.emitOwnEvents) {
process.nextTick(async () => {
await processingMutex.mutex(() => upsertMessage(fullMsg, 'append'))
await messageMutex.mutex(() => upsertMessage(fullMsg, 'append'))
})
}