Skip to content

Comments

fix: streamline JID handling by removing redundant checks and acknowledgments#2352

Open
jlucaso1 wants to merge 1 commit intomasterfrom
optimize-ignore-jid
Open

fix: streamline JID handling by removing redundant checks and acknowledgments#2352
jlucaso1 wants to merge 1 commit intomasterfrom
optimize-ignore-jid

Conversation

@jlucaso1
Copy link
Collaborator

@jlucaso1 jlucaso1 commented Feb 20, 2026

Moves the shouldIgnoreJid check from inside each handler (handleMessage, handleReceipt, handleNotification) up into processNode so ignored JIDs are acked and dropped before entering the event buffer or offline queue.

Previously every ignored message still went through the full ev.buffer()/ev.flush() cycle and handler invocation just to be discarded. In setups with many sessions in a single process this added thousands of unnecessary buffer cycles for group/broadcast messages during history sync.

Messages still get a proper ack (error 500 for messages, clean ack for receipts/notifications) matching the original behavior. Calls are excluded since they don't use shouldIgnoreJid.

@whiskeysockets-bot
Copy link
Contributor

Thanks for opening this pull request and contributing to the project!

The next step is for the maintainers to review your changes. If everything looks good, it will be approved and merged into the main branch.

In the meantime, anyone in the community is encouraged to test this pull request and provide feedback.

✅ How to confirm it works

If you’ve tested this PR, please comment below with:

Tested and working ✅

This helps us speed up the review and merge process.

📦 To test this PR locally:

# NPM
npm install @whiskeysockets/baileys@WhiskeySockets/Baileys#optimize-ignore-jid

# Yarn (v2+)
yarn add @whiskeysockets/baileys@WhiskeySockets/Baileys#optimize-ignore-jid

# PNPM
pnpm add @whiskeysockets/baileys@WhiskeySockets/Baileys#optimize-ignore-jid

If you encounter any issues or have feedback, feel free to comment as well.

@jlucaso1 jlucaso1 requested a review from purpshell February 20, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants