brianc / node-pg-pool

A connection pool for node-postgres
MIT License
180 stars 64 forks source link

Handle client errors in pool.query #131

Closed johanneswuerbach closed 4 years ago

johanneswuerbach commented 4 years ago

If an error not related to the query occurs, the client is emitting an error event.

Forward this event to the callback.

Fixes https://github.com/brianc/node-pg-pool/pull/123#issuecomment-531603798

Karacala commented 4 years ago

Any news on that PR ?

If an error occurs (eg. "Connection terminated unexpectedly"), we're unable to catch the error which lead to uncaughtException.

zckrs commented 4 years ago

@Gobie @johanneswuerbach

This PR will resolve a ugly problem on our servers on kubernetes cluster.

Sometimes a read only replica pod will be delete per kube orchestrator.

We listen the error event on Pool. But the first error are throw on client. So we ending in uncaughtException who stop process.

What do you need to merge/release this fix ?

Gobie commented 4 years ago

I'm fine with the change. I just mentioned that test could be simpler. Either way @brianc has to approve it, I'm just an invested bystander.

zckrs commented 4 years ago

All check are green.

Someone can merge/release this PR ?

cc @charmander @brianc

brianc commented 4 years ago

yup can merge & release. I'm moving this repo back into the main pg repo so I can better track all issue in one place soon too.