wal 0.0.28 → 0.0.29

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/exe/wal +8 -0
  3. data/lib/wal/version.rb +1 -1
  4. data/rbi/wal.rbi +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25baa32e6f2d21ec2e2e4d2f1d1e6cbfa923b50bbb83aef360e3915548ad294f
4
- data.tar.gz: 70c3b57c2256c7313893c3333e18f7c0e0f3d10bc9c976fe93629779312b32e2
3
+ metadata.gz: 7decfb78b8ccea001e781411dbcbbe939e9a7a30f29767a306e7c0c98107aba1
4
+ data.tar.gz: 976ec1815c1f379b966fcdd963e522644be2c7a5623939dc839e17673970a71f
5
5
  SHA512:
6
- metadata.gz: 00e5fd5953df779aaaead0554987a0441c2a441c0be987489e4b1e50c4e838b3bef659c7168a64ed1a1f9e42c003169621c925e2c77e9631ec75d8729c3238c2
7
- data.tar.gz: 2ab200a8bcfcc61ca06baf60fc0d5d2a43af8b2660a5b8713a428016b403d47298ad11354f02d4fe650346f9de2b8a4078ba47bce99135de69f0474ea9b9e9e1
6
+ metadata.gz: 1b8b9af4f0936ee756aeb492b3de17b68e17472af6d17ce05574c3bda747c28f1e73910490994a02d6f0255e59f2187d1e5e41927ddbdff39e113cc866950086
7
+ data.tar.gz: b0e185bf497f7dbc188eab4ef6935277a16e7a521c06a001b81374d68761954198852a7af1c68f51db5b126699b7f97666be66d8d7ea0ab14c95fd32a8120b95
data/exe/wal CHANGED
@@ -89,6 +89,7 @@ def start_worker(db_config, slot, config)
89
89
  temporary = config["temporary"] || false
90
90
  publications = config["publications"] || []
91
91
  replicator_class = config["replicator"].presence&.constantize || Wal::Replicator
92
+ auto_restart = config["auto_restart"].nil? || config["auto_restart"]
92
93
  max_retries = config["retries"]&.to_i || (2**32 - 1)
93
94
  retries = 0
94
95
  backoff = config["retry_backoff"]&.to_f || 1
@@ -102,6 +103,13 @@ def start_worker(db_config, slot, config)
102
103
  replicator = replicator_class.new(replication_slot:, use_temporary_slot:, db_config:)
103
104
  replicator = Wal::LoggingReplicator.new(replication_slot, replicator)
104
105
  replicator.replicate_forever(watcher, publications:)
106
+ if auto_restart
107
+ backoff_time = backoff_expoent ? (backoff * retries) ** backoff_expoent : backoff
108
+ puts "Watcher finished for #{replication_slot}, auto restarting in #{backoff_time.floor(2)}..."
109
+ sleep backoff_time
110
+ puts "Restarting #{replication_slot}"
111
+ redo
112
+ end
105
113
  rescue StandardError => err
106
114
  if retries < max_retries
107
115
  Wal.logger&.error("[#{replication_slot}] Error #{err}")
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.28"
4
+ VERSION = "0.0.29"
5
5
  end
data/rbi/wal.rbi CHANGED
@@ -7,7 +7,7 @@ module Wal
7
7
  UpdateEvent,
8
8
  DeleteEvent,
9
9
  ) }
10
- VERSION = "0.0.28"
10
+ VERSION = "0.0.29"
11
11
 
12
12
  class << self
13
13
  sig { returns(T.class_of(Logger)) }
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.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Navarro
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-01-16 00:00:00.000000000 Z
10
+ date: 2026-01-20 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: pg