Skip to content

Conversation

@sjpotter
Copy link

Just a thought on that the shift/pop functions should take a timeout as well.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant