ch_connect 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 200d184420e49176978c3e733563dee1bce43abd3ae68ec00c8d8dedba2a3d93
4
- data.tar.gz: 701d1c607774c4751b78e7abe8deb8f0927ae671887159e2aba4f5386568a63c
3
+ metadata.gz: 50be174654df1074c817ad1cf895a206bc165452dda7fc47b4b6209aa622565f
4
+ data.tar.gz: e0b9467ebc013a701653ff16c277651e0e81fac81d225ea6d9cc5f2d64b5bb57
5
5
  SHA512:
6
- metadata.gz: 544a541108591c31bbff5381d73b3659f278013f29bd380b25b056fe9a2066402691a70d4fd705dd35513fa425b4267e35d3e8be06885a5e10ec7d5ed9a81701
7
- data.tar.gz: 6d1ca3c49203d5c7eea71886aba4dfa70447fa1adbad832fd6b9736a6ffad4a02a58f425c56921a1e1b109a1a879de4178889fa1c33c04beeb7cb01830fcd57f
6
+ metadata.gz: 27992acbdb31511f7838201941f09f36587f2786e2df1b0bb000acc308405fd93d494955c202d0c732c2eace0bde0b0c5ffb106887f5ac9321c028e09d832384
7
+ data.tar.gz: 6e64f8873f628a856e21f199462c9eef435216ef0c8ea72f7f959a744e10115d85b63cf51f0700babd7919a8f8eb514f13557adc54077a14b01d5e49e1c2a753
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## Unreleased
2
2
 
3
+ ## [0.2.1] - 2026-02-08
4
+
5
+ - Added automatic retries on connection errors with configurable `max_retries` (default: 3) ([#6](https://github.com/kukicola/ch_connect/pull/6))
6
+
3
7
  ## [0.2.0] - 2026-01-31
4
8
 
5
9
  - 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
 
@@ -178,6 +179,7 @@ response = conn.query(
178
179
  | `write_timeout` | `60` | Write timeout in seconds |
179
180
  | `pool_size` | `100` | Connection pool size |
180
181
  | `pool_timeout` | `5` | Pool checkout timeout in seconds |
182
+ | `max_retries` | `3` | Max retry attempts on connection errors (0 to disable) |
181
183
  | `instrumenter` | `NullInstrumenter` | Instrumenter for query instrumentation |
182
184
 
183
185
  ## Instrumentation
@@ -24,6 +24,7 @@ module ChConnect
24
24
  write_timeout: 60,
25
25
  pool_size: 100,
26
26
  pool_timeout: 5,
27
+ max_retries: 3,
27
28
  instrumenter: NullInstrumenter.new
28
29
  }.freeze
29
30
 
@@ -38,8 +39,9 @@ module ChConnect
38
39
  # @return [Integer] Write timeout in seconds
39
40
  # @return [Integer] Connection pool size
40
41
  # @return [Integer] Pool checkout timeout in seconds
42
+ # @return [Integer] Max retry attempts on connection errors
41
43
  # @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
44
+ attr_accessor :scheme, :host, :port, :database, :username, :password, :connection_timeout, :read_timeout, :write_timeout, :pool_size, :pool_timeout, :max_retries, :instrumenter
43
45
 
44
46
  # Creates a new configuration instance.
45
47
  #
@@ -55,6 +57,7 @@ module ChConnect
55
57
  # @option params [Integer] :write_timeout write timeout in seconds (default: 60)
56
58
  # @option params [Integer] :pool_size connection pool size (default: 100)
57
59
  # @option params [Integer] :pool_timeout pool checkout timeout (default: 5)
60
+ # @option params [Integer] :max_retries max retry attempts on connection errors (default: 3)
58
61
  def initialize(params = {})
59
62
  DEFAULTS.merge(params).each do |key, value|
60
63
  send("#{key}=", value)
@@ -14,6 +14,7 @@ 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,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChConnect
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ch_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karol Bąk