Skip to content

Fix: ConfirmChannel callbacks silently dropped on close when some publishes had no callback#846

Merged
cressie176 merged 2 commits into
mainfrom
fix/191-confirm-callbacks-dropped-on-close
May 5, 2026
Merged

Fix: ConfirmChannel callbacks silently dropped on close when some publishes had no callback#846
cressie176 merged 2 commits into
mainfrom
fix/191-confirm-callbacks-dropped-on-close

Conversation

@cressie176

Copy link
Copy Markdown
Collaborator

Fixes #191

pushConfirmCallback stores false for publishes with no callback (i.e. when using waitForConfirms instead of per-message callbacks). The close event drain used while (cb) which stops at the first false entry, silently dropping all callbacks queued after it.

Fixed by iterating the full array in the close handler, calling real callbacks, then filtering out called entries so waitForConfirms can still wrap the remaining false slots into rejecting promises.

Also tidied waitForConfirms: use the local unconfirmed reference consistently, and rename val to cb for clarity.

🤖 Generated with Claude Code

cressie176 and others added 2 commits May 5, 2026 05:44
…blishes had no callback

pushConfirmCallback stores `false` for publishes with no callback. The
close event drain used `while (cb)` which stops at the first `false`,
silently dropping any callbacks queued after it. Fixed by iterating the
full array and filtering out called entries afterwards.

Also tidied waitForConfirms: use the local `unconfirmed` reference
consistently, and rename `val` to `cb` for clarity.

Fixes #191

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cressie176
cressie176 merged commit f19b8fd into main May 5, 2026
4 checks passed
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.

ConfirmChannel's publish callback not invoked on channel error

1 participant