ch_connect 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +3 -0
- data/lib/ch_connect/config.rb +7 -1
- data/lib/ch_connect/http_transport.rb +3 -1
- data/lib/ch_connect/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1975451cfb97c84b89c7153fcd18a8057477ea5fd3a13a21a0b11463343b124a
|
|
4
|
+
data.tar.gz: e5182056af628032f2faf8b8f17732870d8c89e6d16fdddc1ccbf70742cfc649
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 64540c1ebc919c74a9f69c738fa47d8d81eab54b39e4b862a3b9651aa0763563cd6cc362739008a7e1020fb0c608f902fcd97e56fd60971b3661d2525958cc33
|
|
7
|
+
data.tar.gz: 2d064557ed0ce3c84e3e9b0f2ad27b1d05c660d3312842d6ece5ce6e3a56329d08829bd4abdeda06cc2fa4570d86b2ccd7eefcec91037c699387bb60de6a4ebb
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## Unreleased
|
|
2
2
|
|
|
3
|
+
## [0.2.2] - 2026-05-06
|
|
4
|
+
|
|
5
|
+
- Added configurable `keep_alive_timeout` for idle persistent connections (default: 8s) ([#7](https://github.com/kukicola/ch_connect/pull/7))
|
|
6
|
+
|
|
7
|
+
## [0.2.1] - 2026-02-08
|
|
8
|
+
|
|
9
|
+
- Added automatic retries on connection errors with configurable `max_retries` (default: 3) ([#6](https://github.com/kukicola/ch_connect/pull/6))
|
|
10
|
+
|
|
3
11
|
## [0.2.0] - 2026-01-31
|
|
4
12
|
|
|
5
13
|
- Added benchmark suite comparing against other ClickHouse Ruby gems ([#5](https://github.com/kukicola/ch_connect/pull/5))
|
data/README.md
CHANGED
|
@@ -8,6 +8,7 @@ Fast Ruby client for ClickHouse database using the Native binary format for effi
|
|
|
8
8
|
|
|
9
9
|
- Native binary format parsing (faster than JSON/TSV)
|
|
10
10
|
- Persistent HTTP connections with built-in connection pooling
|
|
11
|
+
- Automatic retries on connection errors
|
|
11
12
|
- Thread-safe concurrent access
|
|
12
13
|
- Supports all common ClickHouse data types
|
|
13
14
|
|
|
@@ -176,8 +177,10 @@ response = conn.query(
|
|
|
176
177
|
| `connection_timeout` | `5` | Connection timeout in seconds |
|
|
177
178
|
| `read_timeout` | `60` | Read timeout in seconds |
|
|
178
179
|
| `write_timeout` | `60` | Write timeout in seconds |
|
|
180
|
+
| `keep_alive_timeout` | `8` | Idle persistent connection timeout in seconds |
|
|
179
181
|
| `pool_size` | `100` | Connection pool size |
|
|
180
182
|
| `pool_timeout` | `5` | Pool checkout timeout in seconds |
|
|
183
|
+
| `max_retries` | `3` | Max retry attempts on connection errors (0 to disable) |
|
|
181
184
|
| `instrumenter` | `NullInstrumenter` | Instrumenter for query instrumentation |
|
|
182
185
|
|
|
183
186
|
## Instrumentation
|
data/lib/ch_connect/config.rb
CHANGED
|
@@ -22,8 +22,10 @@ module ChConnect
|
|
|
22
22
|
connection_timeout: 5,
|
|
23
23
|
read_timeout: 60,
|
|
24
24
|
write_timeout: 60,
|
|
25
|
+
keep_alive_timeout: 8,
|
|
25
26
|
pool_size: 100,
|
|
26
27
|
pool_timeout: 5,
|
|
28
|
+
max_retries: 3,
|
|
27
29
|
instrumenter: NullInstrumenter.new
|
|
28
30
|
}.freeze
|
|
29
31
|
|
|
@@ -36,10 +38,12 @@ module ChConnect
|
|
|
36
38
|
# @return [Integer] Connection timeout in seconds
|
|
37
39
|
# @return [Integer] Read timeout in seconds
|
|
38
40
|
# @return [Integer] Write timeout in seconds
|
|
41
|
+
# @return [Integer] Keep-alive timeout for idle persistent connections in seconds
|
|
39
42
|
# @return [Integer] Connection pool size
|
|
40
43
|
# @return [Integer] Pool checkout timeout in seconds
|
|
44
|
+
# @return [Integer] Max retry attempts on connection errors
|
|
41
45
|
# @return [#instrument] Instrumenter for query instrumentation
|
|
42
|
-
attr_accessor :scheme, :host, :port, :database, :username, :password, :connection_timeout, :read_timeout, :write_timeout, :pool_size, :pool_timeout, :instrumenter
|
|
46
|
+
attr_accessor :scheme, :host, :port, :database, :username, :password, :connection_timeout, :read_timeout, :write_timeout, :keep_alive_timeout, :pool_size, :pool_timeout, :max_retries, :instrumenter
|
|
43
47
|
|
|
44
48
|
# Creates a new configuration instance.
|
|
45
49
|
#
|
|
@@ -53,8 +57,10 @@ module ChConnect
|
|
|
53
57
|
# @option params [Integer] :connection_timeout connection timeout in seconds (default: 5)
|
|
54
58
|
# @option params [Integer] :read_timeout read timeout in seconds (default: 60)
|
|
55
59
|
# @option params [Integer] :write_timeout write timeout in seconds (default: 60)
|
|
60
|
+
# @option params [Integer] :keep_alive_timeout idle persistent connection timeout in seconds (default: 8)
|
|
56
61
|
# @option params [Integer] :pool_size connection pool size (default: 100)
|
|
57
62
|
# @option params [Integer] :pool_timeout pool checkout timeout (default: 5)
|
|
63
|
+
# @option params [Integer] :max_retries max retry attempts on connection errors (default: 3)
|
|
58
64
|
def initialize(params = {})
|
|
59
65
|
DEFAULTS.merge(params).each do |key, value|
|
|
60
66
|
send("#{key}=", value)
|
|
@@ -14,11 +14,13 @@ module ChConnect
|
|
|
14
14
|
@config = config
|
|
15
15
|
@base_url = "#{config.scheme}://#{config.host}:#{config.port}"
|
|
16
16
|
@http_client = HTTPX.plugin(:persistent, close_on_fork: true)
|
|
17
|
+
.plugin(:retries, max_retries: config.max_retries, retry_change_requests: true)
|
|
17
18
|
.with(
|
|
18
19
|
timeout: {
|
|
19
20
|
connect_timeout: config.connection_timeout,
|
|
20
21
|
read_timeout: config.read_timeout,
|
|
21
|
-
write_timeout: config.write_timeout
|
|
22
|
+
write_timeout: config.write_timeout,
|
|
23
|
+
keep_alive_timeout: config.keep_alive_timeout
|
|
22
24
|
},
|
|
23
25
|
pool_options: {
|
|
24
26
|
max_connections_per_origin: config.pool_size,
|
data/lib/ch_connect/version.rb
CHANGED