Skip to content
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

fix: respect min pool configuration #23

Closed
wants to merge 1 commit into from

Conversation

SergeyCherman
Copy link

Attempts to fix #22 by acquiring up to the min connections.

I suspect I need to add handlers to make sure it doesn't dispose of the min connections, but not sure. Also unsure if this is the right way to resolve the issue. Wanted to get the conversation started via the PR.

@@ -442,6 +442,15 @@ export class Pool<RawResource> {
this._pendingAcquires.push(deferred);
this._dispense();

let i, diff;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like copy paste from _ensureMinimum, just call that method here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a subtle difference, _ensureMinimum calls createResource without returning a promise. Using ensure minimum would hence cause the acquire method to return before the resource creation is done. This would have the potential of an unhandled exception if the exception occurs after the promise is returned.

Should ensure minimum be updated to return a promise?

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.

Min Pool is not respected
2 participants