add timeout support to blocking queue operations#8
Open
sjpotter wants to merge 4 commits intoflarestart:masterfrom
Open
add timeout support to blocking queue operations#8sjpotter wants to merge 4 commits intoflarestart:masterfrom
sjpotter wants to merge 4 commits intoflarestart:masterfrom
Conversation
points to lack in tests that only test with one element in queue so pop/shift return same result
* small refactor of LinkedList code for symmetry * fix time out handling, so clearListeners doesn't error out tiemd out handler * remove only handling one pending listener per event loop loop, handle all * count the number of listeners - and due to how they remain on the listener list until processed, keep a delta for the timed out ones. * cleanup the duplicative switches for pop/shift with some .bind() magic * improve/add to tests
refactored a lot of code to clean it up. * changed linkedlist implementation * no longer takes multiple elements, easy enough to either 1) add a new function that is a multi push/unshift 2) just put that logic on the user the reason for this change is to make the WaitQueue's listener removal / count logic simpler. With only one element added, easy to return a "removable" node. This removable node can be removed at tieout time, removing "real" non waiting promises from the listener queue. * with the above, added a remove() member to linkedlist that takes the returned node and removes it from anywhere in the list * change the implementation of linkedlist to use a list head implementation * adjusts the iterator for new linked list format * removed multi push/unshift tests * updated waitqueue to benefit from linkedlist changes * no longer leaving in listeners until they are "flushed out of the list, get removed right away - no longer need to do math to know how many listeners are waiting * for iterator, return the underlying linked list's iterator instead of reimplementing it
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.
Just a thought on that the shift/pop functions should take a timeout as well.