Closed sneako closed 4 years ago
@josevalim here is the deadline PR based on this branch https://github.com/sneako/nimble_pool/pull/1
I dropped just one tiny comment!
Hi @sneako! I have merged the deadline code into master. We can still leave this open in case we want to merge min_ready
in the future, but I am hoping we can get away with it in the lazy pool. :)
Thank you for your contributions! :green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart:
Sounds good! Thanks for your guidance! ❤️
Closing this as I believe we don't need min_ready for now. :)
For completeness, what we did in finch was to start the connection lazily. Therefore, if you need min_ready, you can have a process after the pool is started that checks out min_ready
.
min_ready
When starting a pool, it will block until min_ready workers have completed their initialization, even if they have an async init callback.
When using async init callbacks, especially callbacks that take some time to complete, the pool can complete initialization before any of the workers have. By configuring min_ready, we can ensure that the pool is ready to use, while still keeping the async behaviour for when workers are removed and added later on.
deadline
Previously, workers would always be restarted when checkout! timed out, to ensure that we could not check in a worker in an unclean state. By using a deadline, we can avoid checking out a client in situations where the checkout will timeout, and therefore avoid restarting the worker