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

Check pg connection #458

Closed
Laboratory opened this issue Oct 25, 2013 · 2 comments · Fixed by #543
Closed

Check pg connection #458

Laboratory opened this issue Oct 25, 2013 · 2 comments · Fixed by #543
Milestone

Comments

@Laboratory
Copy link

Hey,

How can I check pg (client|connection) connection for reconnect to DB?
My work flow:

  • create pg.Client (ok)
  • client.query (ok)
  • turn off internet connection (ok)
  • client.query (wait indefinitely) (fail)
  • turn on internet connection (ok)
  • client.query (wait indefinitely) (fail)

All my handlers are silent (client.on('end'), client.connection.on('error'), client.connection.stream.on('end'), client.connection.stream.on('error'), ...)

Thx, Vitaly

@strk
Copy link
Contributor

strk commented Mar 14, 2014

@Laboratory could you please test strk@fb491cf ?

@Laboratory
Copy link
Author

@strk I'll check it later

strk pushed a commit to strk/node-postgres that referenced this issue Mar 14, 2014
Instead, consider receiving a premature stream end while a query
is in progress as an error sign, bubbling up the error to the
client level. Fixes the testsuite while still fixing my cases
and possibly brianc#458.

The correct fix would be to provide a .validate method to the
pooler, and expose a .validate method to the client and to the
connection classes for that purpose...
@brianc brianc added this to the v3.0 milestone Mar 15, 2014
strk pushed a commit to CartoDB/node-postgres that referenced this issue Mar 17, 2014
strk pushed a commit to CartoDB/node-postgres that referenced this issue Mar 18, 2014
Might fix brianc#458
Fixes CartoDB/CartoDB-SQL-API#135
Avoids loop between pool.destroy and client.end
strk pushed a commit to CartoDB/node-postgres that referenced this issue Mar 18, 2014
Might fix brianc#458
Fixes CartoDB/CartoDB-SQL-API#135
Avoids loop between pool.destroy and client.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants