Skip to content

Clear connection timeout on error #2015

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

Merged
merged 1 commit into from
Dec 12, 2019
Merged

Clear connection timeout on error #2015

merged 1 commit into from
Dec 12, 2019

Conversation

adam-nielsen
Copy link
Contributor

If the connection gets unexpectedly dropped during the connection phase (in my case because the database is too busy) then the error handler doesn't cancel the connection timeout. This results in an 'unexpected disconnection' error, followed some seconds later by a 'connection timeout' error.

This prevents any user code from terminating while the second timeout handler is counting down, which in some environments (like AWS Lamba) where you pay by the second, will cost more money while the script sits there waiting for the now superfluous connection timeout to expire.

This PR cancels the connection timeout in the error handler, allowing scripts that wish to exit immediately to do so.

Cancel the connection timeout upon stream error, to avoid getting a stream error followed later by a connection error.
@charmander
Copy link
Collaborator

This looks right! Do you think you can add a test? (If not, that’s okay – I’ll be able to at some point.)

@brianc
Copy link
Owner

brianc commented Dec 3, 2019

ohh nice good catch! @charmander you wanna wait on a test before merging & merge & write a test later?

@brianc brianc merged commit b03a3bd into brianc:master Dec 12, 2019
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.

3 participants