Skip to content
This repository was archived by the owner on Dec 30, 2019. It is now read-only.

Handle client errors in pool.query - #131

Merged
brianc merged 1 commit into
brianc:masterfrom
johanneswuerbach:pool-query-error
Dec 18, 2019
Merged

brianc merged 1 commit into
brianc:masterfrom
johanneswuerbach:pool-query-error

Conversation

@johanneswuerbach

@johanneswuerbach johanneswuerbach commented Sep 16, 2019 •

Copy link
Copy Markdown
Contributor

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

Forward this event to the callback.

Fixes #123 (comment)

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

Forward this event to the callback.
Comment thread test/error-handling.js
})

setTimeout(() => {
pool._clients[0].end()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

to avoid the double error one could trigger the error directly pool._clients[0].connection.stream.emit('error', new Error())

@Karacala

Karacala commented Dec 3, 2019

Copy link
Copy Markdown

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

zckrs commented Dec 4, 2019

Copy link
Copy Markdown

@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

Gobie commented Dec 4, 2019 •

Copy link
Copy Markdown

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

zckrs commented Dec 18, 2019

Copy link
Copy Markdown

All check are green.

Someone can merge/release this PR ?

cc @charmander @brianc

@brianc

brianc commented Dec 18, 2019

Copy link
Copy Markdown
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants