fix(Interceptor): wrap the "once" event listener, ditch "untilIdle" Promise#430
Merged
kettanaito merged 8 commits intomainfrom Sep 20, 2023
Merged
fix(Interceptor): wrap the "once" event listener, ditch "untilIdle" Promise#430kettanaito merged 8 commits intomainfrom
kettanaito merged 8 commits intomainfrom
Conversation
kettanaito
commented
Sep 18, 2023
| eventName: EventName, | ||
| listener: Listener<any> | ||
| ): this { | ||
| const wrappedListener = this.wrapListener(eventName, listener) |
Member
Author
There was a problem hiding this comment.
once listener has to be wrapped the same as the on listener to open the event queue once the respective event is emitted.
a5fc1e7 to
2a54cdc
Compare
2a54cdc to
92d1b71
Compare
85b101e to
3dbd7d2
Compare
3dbd7d2 to
70f2150
Compare
Member
Author
Released: v0.25.2 🎉This has been released in v0.25.2! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
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.
Changes
This change drops the internal implementation of
AsyncEventEmitterused to await allrequestlisteners from being done. Instead, it introduces aRequestConrtollerthat just holds a response Promise to whichever surface calling.respondWith().The request listener await logic is achieved by:
oncerequest listener that always responds to the intercepted request with `undefined. using the request controller. This leverages the native listeners execution order to provide a fall-safe listener in case the consumer hasn't handled the request in any way.emitAsyncutility to account for async request listeners.emitAsyncexecutes all the listeners for the given events awaiting them (i.e. in order).