Add a test to demonstrate failure #3
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.
First off, wanted to say thank you for creating this library!
While trying to evaluate it as a solution for a use case of mine, I ran into some unexpected results. While debugging, it became clear that
take-batchis not working as I had expected.I've created a minimal test case to highlight the issue I'm seeing (this test is currently failing!), and it has to do with the query being issued via
locking-take-batch. It appears that the underlyingunion allquery is introducing duplicate items into the batch result. I started to analyze the query, but wanted to make sure that my expectations are indeed how it was designed to work before going too far down that path.Test output
Related, but not fully relevant
In case it helps, my use case is that I want to be able to take a set of horizontally scaled servers and have each of them put onto the same queue, and to wait for a small window, and then to let them race and have a single winner recover the items. I had tried to use
countto guide how many items to pull fromtake-batch, but was running into some issues based on the race puts, so I decided to just provide the take-batch argument directly, asking for 10 items (since I have fewer than 10 servers I plan on using). The idea is that this should take all of the available items, and that there should be only as many as were put on the queue.