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.1: Keep-Alive sockets housekeeping #169

Merged
merged 6 commits into from
Jul 3, 2023
Merged

Conversation

slvrtrn
Copy link
Contributor

@slvrtrn slvrtrn commented Jun 27, 2023

Summary

This is a potential fix for #150.

  • Introduce a mechanism to detect a potentially expired socket on the client side when using Keep-Alive. If such socket is detected, and retry is enabled in the configuration, both socket and request will be immediately destroyed, and the client will try again.
  • Allow disabling Keep-Alive on the client side entirely.
  • TRACE log level added

It'd be nice to have a freeSocketTimeout setting to remove expired idling sockets in the background before we even try to use them (such as in agentkeepalive). Still, even there, it was not working as I expected.

Checklist

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@slvrtrn slvrtrn requested a review from mshustov June 27, 2023 23:59
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
src/connection/retry_strategy.ts Outdated Show resolved Hide resolved
__tests__/unit/http_adapter.test.ts Outdated Show resolved Hide resolved
Copy link
Member

@mshustov mshustov left a comment

Choose a reason for hiding this comment

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

LGTM

__tests__/integration/config.test.ts Outdated Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
src/connection/retry_strategy.ts Outdated Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
@slvrtrn slvrtrn marked this pull request as ready for review June 29, 2023 17:05
@slvrtrn slvrtrn changed the title WIP: Keep-Alive sockets housekeeping Keep-Alive sockets housekeeping Jun 29, 2023
@slvrtrn slvrtrn changed the title Keep-Alive sockets housekeeping 0.1.1: Keep-Alive sockets housekeeping Jun 29, 2023
__tests__/unit/http_adapter.test.ts Outdated Show resolved Hide resolved
src/client.ts Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Outdated Show resolved Hide resolved
src/connection/adapter/base_http_adapter.ts Show resolved Hide resolved
@slvrtrn slvrtrn merged commit 52e3a96 into main Jul 3, 2023
@slvrtrn slvrtrn deleted the sockets-housekeeping branch July 3, 2023 13:34
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.

2 participants