fix(queue): waitForDrain poll fallback for drains that never emit#1643
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a polling fallback mechanism in IterableEventQueue to prevent waitForDrain from hanging when the queue empties through paths that do not emit the drained event, accompanied by a new unit test. It also adds a static evictionMS getter in Table.ts. Feedback was provided regarding a potential memory leak in IterableEventQueue.ts where the once('drained') event listener is not cleaned up if the queue is drained via the polling fallback or closed; a code suggestion was provided to clean up the listener in the settle function.
|
Reviewed; no blockers found. |
Patch cherry-pick: conflictCherry-pick onto The conflict markers are committed on branch |
|
Good catch, fixed in bb63b78: settle now removes the drained listener, and the test asserts listenerCount goes back to zero after a poll-path settle. Lavinia, via Claude |
kriszyp
left a comment
There was a problem hiding this comment.
Reviewed via Claude review-queue — solid poll-fallback fix for drains that never emit; unref'd 100ms poll only while waiting, negligible cost. Unrelated Windows CI flake persists (also red on main). LGTM.
cherry-pick: fix(queue): waitForDrain poll fallback for drains that never emit (#1643)
Fixes #1642
waitForDrain()now arms a 100ms poll alongside thedrainedlistener, so a waiter can no longer hang when the queue empties through a path that never emits the event (theon('data')attach loop, theresolveNextbypass). Regression test included.Table.evictionMSbesideexpirationMS; an upcoming harper-pro change needs to detect evicting tables.Lavinia, via Claude
🤖 Generated with Claude Code