-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Queue impl parity #79
Queue impl parity #79
Conversation
limiter/lifo_blocking.go
Outdated
@@ -11,7 +11,7 @@ import ( | |||
|
|||
type lifoElement struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes were included because I branched off #78
If that PR gets merged I can rebase and this diff should be resolved
limiter/queue_blocking.go
Outdated
var element *list.Element | ||
switch q.ordering { | ||
case OrderingFIFO: | ||
element = q.list.Back() | ||
case OrderingLIFO: | ||
element = q.list.Front() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is essentially the biggest difference between this impl and what exists in the lifo impl. It is also the only code path where we have any logic dependent on the queue order
@@ -0,0 +1,474 @@ | |||
package limiter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these tests were sourced from lifo_blocking_test.go
and fifo_blocking_test.go
bf6da34
to
1bdff02
Compare
f45e8ae
to
21f8866
Compare
ed5b5fe
to
92dcf34
Compare
92dcf34
to
13bbdfe
Compare
looks good, mind addressing these |
No prob. Missed those. Ill take care of it now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 nice work, thanks for all the contributions!
This PR creates a new limiter type named
QueueBlockingLimiter
. This limiter is meant to replaceLifoBlockingLimiter
as well asFifoBlockingLimiter
. This new queue takes all the improvements made to the lifo queue implementation as well as refactors the queue implementation to use aList
internally, just like the fifo queue impl. The queue direction is controlled via configuration enum passed in at instantiation time. The existing queue tests have been ported over. If this proposal is acceptable then one thing I would like a little guidance on is what course of action to take for the existing queues and pool implementations? Would it make sense to fully deprecate the old methods and wait a few release cycles or remove them completely and release a breaking change.EDIT: I used a combination of type aliasing and embedding to deprecate the older queue limiter types