Closed chriskchew closed 4 years ago
Hello! I see you are a first-time contributor, thank you for taking the time to help Sequelize! I hope to see more PRs from you in the future!
I will now review your PR!
Hello! I see you are a first-time contributor, thank you for taking the time to help Sequelize! I hope to see more PRs from you in the future!
I will now review your PR!
Yes, "long time listener first time caller". :)
Thank you for reviewing and considering the change.
@sushantdhiman Do you have any idea why travis tests did not execute?
@papb Travis failed to report build status for last commit. After restarting build is green
Awesome! Thanks for the great work! Hope to see more PRs from you in the future :)
My team has encountered a situation where new read replicas are not used when they have been added after the node process has already started and filled the connection pool with healthy connections. This change offers a way to rebalance the load across a cluster by limiting the lifetime of a resource in the pool.
Once a resource has been used and released
maxUses
times, upon release the resource is destroyed rather than recycled. Over a period of minutes or hours, depending on load volume and themaxUses
config, connections will be "end-of-lifed" and replaced with new ones based on the balancing strategy used by the system (e.g. load balancer reverse proxy, DNS round-robin, etc.).In essence, the change extends the pre-existing pattern of wrapping the resource with metadata when adding it to the availables list: First it adds a
useCount
counter next totimeout
, then it repeats the pattern for the in-use list so that the useCount metadata can be preserved across acquisitions and releases.I appreciate your help reviewing this PR and hopefully adopting it, as it will greatly increase our ability to continue to grow with Sequelize. Thank you!