Skip to content

Fix issue #473 (Make Pool emit a "connection" event) #474

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

Closed
wants to merge 4 commits into from

Conversation

marcuswestin
Copy link
Contributor

The first of these two patches adds a failing test case which demonstrates an issue with the current implementation of Pool and its createConnection option.

The second patch makes Pool an EventEmitter which emits the "connection" event when it successfully adds an open connection to the pool. This second patch also includes a test case demonstrating the use of and need for something like this (in order to set session variables on pooled connections before they are used).

Cheers!
Marcus

…ccesfully been added to the pool, but before any Pool#getConnection callbacks are called. This allows for a pool of connections to e.g. set MySQL session variables on each of its connections before they are used
…ion if the queue of pending connection requests gets larger than the queueLimit. This is a safeguard to detect code which leaks connections sooner rather than later. The new functionality covered in test/integration/pool/test-queue-limit.js
@dresende
Copy link
Collaborator

dresende commented May 7, 2013

The test case which fails is really suposed to fail or are you pushing some fix?

@marcuswestin
Copy link
Contributor Author

Thanks for swift response @dresende.

I added the failing test case to demonstrate an issue with the createConnection option of Pool which remains unresolved. Since no obvious and good way to fix it comes to mind for me, I was hoping it would cause discussion that leads to an answer.

The answer may be to simply leave things as is, but I do think expectations may be violated by letting the user create a connection themselves but not letting them issue any queries on it until after it has been added to the pool.

If 874f51c is good to merge but we don't want to do anything about the createConnect problem I can create a separate PR with only 874f51c.

@marcuswestin
Copy link
Contributor Author

This issue is being addressed in #486.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants