Fix: reject midInProcess callback on close#54
Open
tayou89 wants to merge 1 commit intost-one-io:masterfrom
Open
Fix: reject midInProcess callback on close#54tayou89 wants to merge 1 commit intost-one-io:masterfrom
tayou89 wants to merge 1 commit intost-one-io:masterfrom
Conversation
When close() is called, midQueue items are properly rejected with an error callback, but midInProcess is silently set to null. This causes the pending callback/promise to hang forever when a connection drops while a MID is being processed. Reject midInProcess with the close error (or default "service unavailable") before nulling, using the same process.nextTick pattern as midQueue items. Add tests for both error-forwarding and default-error cases. Handle unhandled promise rejections in existing sendMid tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #53 —
midInProcesscallback is not invoked whenclose()is called, causing promises to hang forever.midInProcesswith the close error (or default "service unavailable") before nulling, using the sameprocess.nextTickpattern asmidQueueitemssendMidtestsThe Problem
When
close()is called,midQueueitems get their callbacks properly rejected (lines 425-430), butmidInProcessis silently set tonull(line 432). Any pending callback/Promise for the in-flight MID hangs forever.The Fix
Test plan
close(err)forwards the error to midInProcess callbackclose()without args uses default "service unavailable"sendMidtests to handle the now-expected promise rejection