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

Unable to reconnect after calling pg.end() #395

Merged
merged 1 commit into from
Feb 26, 2014
Merged

Conversation

aaronyo
Copy link
Contributor

@aaronyo aaronyo commented Jul 10, 2013

I discovered this while doing tests with pg. Between tests, pg.end() is called to clear out the pool, and then I call pg.connect() again, with the same connection string.

Is there a better way to dump the pool (e.g. any hung connections) and create a new pool?

I have not yet added additional tests, but did confirm that existing tests still pass.

Leaving a reference to the pool means the
destroyed pool will get returned if you
later try to reconnect with the same
connection string.
@brianc
Copy link
Owner

brianc commented Jul 10, 2013

I think that change is logical certainly. I think a simple test case would be something like connecting, disconnecting, and destroying a pool a few times with pg#connect and pg#end. Doesnt have to be anything fancy.

I definitely appreciate the pull request. Once you get it tested I'll merge! 😄

@aaronyo
Copy link
Contributor Author

aaronyo commented Jul 10, 2013

Will take me a couple days to get to this. Busy times. Do you have an opinion on if this fits better as a unit or integration test? Haven't looked much into it so don't have a clear sense of what's mocked for the units, etc.

@brianc
Copy link
Owner

brianc commented Jul 10, 2013

Integration test I think. A lot of the stuff with connect/disconnect/reconnect is vulnerable to timing bugs which unit tests don't catch.

@brianc
Copy link
Owner

brianc commented Oct 1, 2013

I can write the tests if you describe in a high level the scenario I can create to reproduce the bug.

brianc added a commit that referenced this pull request Feb 26, 2014
Unable to reconnect after calling pg.end()
@brianc brianc merged commit be37756 into brianc:master Feb 26, 2014
@brianc
Copy link
Owner

brianc commented Feb 26, 2014

Thanks for your help. Sorry for the delay - life gets crazy some times. 😄

@aaronyo
Copy link
Contributor Author

aaronyo commented Feb 26, 2014

Glad you were able to merge this. Sorry I never found the time to help with the followup (i.e., tests).

@jsongHBO
Copy link

jsongHBO commented Apr 2, 2014

Hi @brianc I can't seem to get this change by doing a npm install . I'm looking at version 2.11.1 on my machine, but it has an outdated index.js. Can you please bump the version number? Or push it to NPM?
Thank you.

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.

None yet

3 participants