wal 0.0.12 → 0.0.14

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: ccfbc3d72aa1155b3ebc567b8476186a9650cdd58d4ba6f8ae8d4fc051e9384e
4
- data.tar.gz: 8ff8fc14c8dc58c321dd5431e6f28dede4f5452fbd0a4f0cb0755c25d96d1b69
3
+ metadata.gz: a10c111df779be284d3a1e20dac362c574d0abed4483d86479ad716c39c868dd
4
+ data.tar.gz: 18763673175466a85adef9b3d91eb6a188bfc2db1b8cd178678757b81a912eb1
5
5
  SHA512:
6
- metadata.gz: 1421db2a176b50c6d868454944a6b59cec9d9b24185ed2774c0e06cb9cb765578fd2f158676c750d9f21768b07db892041ed090b36dc7a4f761f1cc97722ea3b
7
- data.tar.gz: f8c9d67dd37c6733f079d3d5bbc536615024114a2de1f3da2e95c832c375547b6ec14736887be73db628831e590ac3377d0e73f3c2e54381306bb003e3d42863
6
+ metadata.gz: 762f7c704d2a0dceafd9c1094e1413dbe272b7c71d676a49bcbc652d0d5266e91de357f8dd44cd5b4e26b8ec0ba2bde628c997b83cb64e1df9a218164d1ec686
7
+ data.tar.gz: ed456c724a0d80a36f7d78bd477a059d89142f68f85293ff9225eb8ad4cc9a1fc3900781cf888c36742bb4406161542d9935fef9e6e3dd3919d4da51fe4f390c
data/exe/wal CHANGED
@@ -45,11 +45,6 @@ if cli["watch"]
45
45
  elsif cli["start"]
46
46
  slots = YAML.load_file(cli["<config-file>"])["slots"]
47
47
 
48
- if slots.size > 1 && slots.values.any? { |slot| slot["replicator"] == "Wal::Pro::Replicator" }
49
- $stderr.puts "Error: wal-pro doesn't support multiple replication slots"
50
- exit 1
51
- end
52
-
53
48
  workers = slots.map do |slot, config|
54
49
  watcher = config["watcher"].constantize.new
55
50
  temporary = config["temporary"] || false
@@ -70,18 +65,24 @@ elsif cli["start"]
70
65
 
71
66
  ping = Thread.new do
72
67
  loop do
73
- ActiveRecord::Base.connection.execute("SELECT pg_logical_emit_message(true, 'wal_ping', '{}')")
68
+ ActiveRecord::Base.connection_pool.with_connection do |conn|
69
+ conn.execute("SELECT pg_logical_emit_message(true, 'wal_ping', '{}')")
70
+ end
74
71
  sleep 20
75
72
  end
76
73
  end
77
74
 
78
75
  workers << ping
79
76
 
80
- Signal.trap("INT") do
77
+ stop_workers = proc do
81
78
  puts "Stopping WAL workers..."
82
79
  workers.each(&:kill)
83
80
  puts "WAL workers stopped"
81
+ exit 0
84
82
  end
85
83
 
84
+ Signal.trap("TERM", &stop_workers)
85
+ Signal.trap("INT", &stop_workers)
86
+
86
87
  workers.each(&:join)
87
88
  end
@@ -86,6 +86,9 @@ module Wal
86
86
  watch_conn.standby_status_update(write_lsn: lsn)
87
87
  end
88
88
 
89
+ in XLogData(lsn:, data: PG::Replication::PGOutput::Message(prefix: "wal_ping"))
90
+ watch_conn.standby_status_update(write_lsn: [watch_conn.last_confirmed_lsn, lsn].compact.max)
91
+
89
92
  in XLogData(data: PG::Replication::PGOutput::Message(prefix:, content:)) if watcher.valid_context_prefix? prefix
90
93
  begin
91
94
  context = JSON.parse(content).presence || {}
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.12"
4
+ VERSION = "0.0.14"
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.12"
10
+ VERSION = "0.0.14"
11
11
 
12
12
  class BeginTransactionEvent < T::Struct
13
13
  prop :transaction_id, Integer, immutable: true
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.12
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Navarro
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-09-09 00:00:00.000000000 Z
10
+ date: 2025-09-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: pg