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

0.1.0 - Timeouts rework, command method #167

Merged
merged 9 commits into from
Jun 20, 2023
Merged

0.1.0 - Timeouts rework, command method #167

merged 9 commits into from
Jun 20, 2023

Conversation

slvrtrn
Copy link
Contributor

@slvrtrn slvrtrn commented Jun 14, 2023

Summary

  • Resolves 3 seconds delay when max_open_connections is set #161
  • node-abort-controller dependency is removed
  • insert response stream is destroyed immediately
  • command method is introduced
  • We are now relying on signals that are passed to the request instead of setting sockets timeouts

Changelog:

Breaking changes

  • connect_timeout client setting is removed, as it was unused in the code.

New features

  • command method is introduced as an alternative to exec.
    command does not expect user to consume the response stream, and it is destroyed immediately.
    Essentially, this is a shortcut to exec that destroys the stream under the hood.
    Consider using command instead of exec for DDLs and other custom commands which do not provide any valuable output.

Example:

// incorrect: stream is not consumed and not destroyed, request will be timed out eventually
await client.exec('CREATE TABLE foo (id String) ENGINE Memory')

// correct: stream does not contain any information and just destroyed
const { stream } = await client.exec('CREATE TABLE foo (id String) ENGINE Memory')
stream.destroy()

// correct: same as exec + stream.destroy()
await client.command('CREATE TABLE foo (id String) ENGINE Memory')

Bug fixes

  • Fixed delays on subsequent requests after calling insert that happened due to unclosed stream instance when using low number of max_open_connections. See #161 for more details.

Checklist

@slvrtrn slvrtrn requested a review from mshustov June 14, 2023 16:52
CHANGELOG.md Outdated Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
src/connection/adapter/https_adapter.ts Outdated Show resolved Hide resolved
src/client.ts Show resolved Hide resolved
@slvrtrn slvrtrn changed the title 0.1.0 - Timeouts rework 0.1.0 - Timeouts rework, command method Jun 20, 2023
CHANGELOG.md Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
@slvrtrn slvrtrn merged commit 999f210 into main Jun 20, 2023
@slvrtrn slvrtrn deleted the timeouts-rework branch June 20, 2023 16:47
@slvrtrn slvrtrn mentioned this pull request Jun 21, 2023
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 seconds delay when max_open_connections is set
2 participants