pgbus 0.8.2 → 0.8.3
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/lib/pgbus/version.rb +1 -1
- data/lib/pgbus/web/streamer/stream_event_dispatcher.rb +23 -15
- 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: a68e87de88b53f6f1b421479e766cbb82b7e6a9fc7a4257cd11cd52ef560f1a7
|
|
4
|
+
data.tar.gz: d8b0f9aeb5f7cd9ff4f14db915d27066918b8fb66e8be80f1710ca07edff02ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 77afe26722276232120c9e0d0b41a3c3e849ac0f86c874500594db675a96b5571a7ec6a9edc30896883162d985f7081236c602f232896a04eafd660b20970b25
|
|
7
|
+
data.tar.gz: 8bd975ab73750cf7d22e99fcc672b86a85f125bf869f35672eb5675257d899a1526c196953f7ab4fe76c1b2a34383524ff105f63ad4bc82f79ccaf8f24c40e2e
|
data/lib/pgbus/version.rb
CHANGED
|
@@ -131,21 +131,16 @@ module Pgbus
|
|
|
131
131
|
msg = @queue.pop
|
|
132
132
|
break if msg == :__stop__
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
wakes, trailing = drain_wakes_for(msg)
|
|
145
|
-
wakes.each { |w| handle(w) }
|
|
146
|
-
handle(trailing) if trailing
|
|
147
|
-
else
|
|
148
|
-
handle(msg)
|
|
134
|
+
begin
|
|
135
|
+
if msg.is_a?(WakeMessage) && msg.payload.nil?
|
|
136
|
+
wakes, trailing = drain_wakes_for(msg)
|
|
137
|
+
wakes.each { |w| handle(w) }
|
|
138
|
+
handle(trailing) if trailing
|
|
139
|
+
else
|
|
140
|
+
handle(msg)
|
|
141
|
+
end
|
|
142
|
+
ensure
|
|
143
|
+
release_ar_connections
|
|
149
144
|
end
|
|
150
145
|
end
|
|
151
146
|
rescue StandardError => e
|
|
@@ -483,6 +478,19 @@ module Pgbus
|
|
|
483
478
|
# if operators actually look at it. All failures are
|
|
484
479
|
# swallowed by StreamStat.record! itself so a stats-table
|
|
485
480
|
# outage cannot block the dispatcher.
|
|
481
|
+
# Release any AR connections the dispatcher fiber acquired during
|
|
482
|
+
# this iteration (typically from StreamStat.record! via BusRecord).
|
|
483
|
+
# Without this, the connection stays leased while the fiber parks
|
|
484
|
+
# on @queue.pop, blocking clear_reloadable_connections! on the
|
|
485
|
+
# next Rails code reload (10s wedge under rack-timeout).
|
|
486
|
+
def release_ar_connections
|
|
487
|
+
return unless defined?(::ActiveRecord::Base)
|
|
488
|
+
|
|
489
|
+
Pgbus::BusRecord.connection_handler.clear_active_connections!
|
|
490
|
+
rescue StandardError => e
|
|
491
|
+
@logger.debug { "[Pgbus::Streamer::StreamEventDispatcher] AR connection release failed: #{e.class}: #{e.message}" }
|
|
492
|
+
end
|
|
493
|
+
|
|
486
494
|
def record_stat(stream_name:, event_type:, started_at:, fanout: nil, ephemeral: false)
|
|
487
495
|
return unless ephemeral || @config.streams_stats_enabled
|
|
488
496
|
|