Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

This test is flaky as written because we repeat until the acquire workflow has completed for the first ten items in the pool as a way of waiting for the pool to be fully initialized. However, an item can be acquired momentarily before it is added to the queue of items to be taken from the pool. So it is possible that:

  1. The first nine items in the pool are initialized
  2. The tenth item in the pool is acquired but has not yet been added to the queue
  3. The subsequent calls to get are executed, causing new items to be acquired because the original one fails
  4. One of these items is added to the internal queue before the original tenth item is added to the queue

We could add further coordination to prevent this from occurring but I don't think this is a problem. The pool is correct to allocate a new item once one of the calls to get returns a failure and I don't think there is any guarantee that an in process item from initialization must be returned by the pool before an item allocated after failure of an entry.

@adamgfraser adamgfraser requested a review from jdegoes January 26, 2023 13:11
@jdegoes jdegoes merged commit d825736 into zio:series/2.x Jan 27, 2023
@adamgfraser adamgfraser deleted the pool branch January 27, 2023 13:10
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.

2 participants