wal 0.0.22 → 0.0.23

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: e7cd3acf2bcf902cb1bbc73a89063a6f360b73bacb52e4764900ece3eaa5e08d
4
- data.tar.gz: 67cf46933f34837e0d7b9730ff87cee2e785e4057adb9fa519f1e80150513a88
3
+ metadata.gz: 3a7144e35e8bfe1df54e18fa1e4b9c94e4bb6926ed0de011e0e4006ce08c44cd
4
+ data.tar.gz: 21196f54b92390273288aac5fed7b5fdcd79842dda0d63cbb0cada583bca8cd3
5
5
  SHA512:
6
- metadata.gz: a8ecd8b4dde1dfb4867c6532da43714d53662482b86f8a76b5adda396edba042d46cd1d1bdb2ed86590efbfb3f29c8946b37094621176c19690b738939affa97
7
- data.tar.gz: ccb32bab9c54f998451f3b10ff1a0895ac06b07f6446ae8aafeb24cc32c10bca2672622790276ac9895b26ca9616a061fad359cf8ac7ac9835366138b248f091
6
+ metadata.gz: 88be295b55c90871dc4aa8731e21c03fff1b890e59a3b9ec000276c5d0b2dad96660b1686328af6e208084fc5389f90c8925dbc27fb29de56e535063eaf20899
7
+ data.tar.gz: a13bd85ed047f5b7bfcfe839bb0ff8643587ae6c6ca81ef4f56809a96e4daff6a6f7423c9eff3a715cfa72f27e84b99765f003b4d40b0eacabf0d73cc7311bbc
data/exe/wal CHANGED
@@ -91,7 +91,10 @@ elsif cli["start"]
91
91
  temporary = config["temporary"] || false
92
92
  publications = config["publications"] || []
93
93
  replicator_class = config["replicator"].presence&.constantize || Wal::Replicator
94
- retries = config["retries"]&.to_i || 5
94
+ max_retries = config["retries"]&.to_i || (2**32 - 1)
95
+ retries = 0
96
+ backoff = config["retry_backoff"]&.to_f || 1
97
+ backoff_expoent = config["retry_backoff_expoent"]&.to_f
95
98
 
96
99
  Thread.new(slot, watcher, temporary, publications) do |replication_slot, watcher, use_temporary_slot, publications|
97
100
  replication_slot = "#{replication_slot}_#{SecureRandom.alphanumeric(4)}" if use_temporary_slot
@@ -103,10 +106,13 @@ elsif cli["start"]
103
106
  begin
104
107
  replicator.replicate_forever(watcher, publications:)
105
108
  rescue StandardError => err
106
- if retries > 0
109
+ if retries < max_retries
107
110
  Wal.logger&.error("[#{replication_slot}] Error #{err}")
108
- retries -= 1
109
- sleep 2 ** retries
111
+ retries += 1
112
+ backoff_time = backoff_expoent ? (backoff * retries) ** backoff_expoent : backoff
113
+ puts "Restarting #{replication_slot} in #{backoff_time.floor(2)}s..."
114
+ sleep backoff_time
115
+ puts "Restarting #{replication_slot}"
110
116
  retry
111
117
  end
112
118
  raise
@@ -155,6 +155,9 @@ module Wal
155
155
  else
156
156
  next
157
157
  end
158
+ rescue
159
+ watch_conn&.close
160
+ raise
158
161
  end
159
162
  end
160
163
 
data/lib/wal/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wal
4
- VERSION = "0.0.22"
4
+ VERSION = "0.0.23"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Navarro
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-10-21 00:00:00.000000000 Z
10
+ date: 2025-10-29 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: pg