feat(buffer): async + collapsing buffer for awaitable batching - #54
Draft
shavounet wants to merge 2 commits into
Draft
feat(buffer): async + collapsing buffer for awaitable batching#54shavounet wants to merge 2 commits into
shavounet wants to merge 2 commits into
Conversation
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.
Stale work — opening as draft to keep it visible. Needs tests + polish before it can be considered for merge.
Summary
AsyncBuffer: register args, get a Promise back, the buffer auto-flushes onevent-loop idle, on min/max wait time, or on size threshold. Caller-supplied flusher
generator resolves the deferred items.
CollapsingBuffer: thin layer overAsyncBufferthat deduplicates by key —duplicate registrations return the same in-flight Promise.
UnresolvedItemsExceptionthrown when the flusher leaves items pending.psr/log: ^3.0for optional debug logging insideAsyncBuffer.Follow-ups before merge
AsyncBuffer(idle/min-wait/max-wait/size triggers, exception path)CollapsingBufferkey dedupdeclare(strict_types=1)toCollapsingBuffer.phpandUnresolvedItemsException.phpUnresolvedItemsException::getItems(): arrayand tighten thearray<>generics