pgbus 0.13.4 → 0.13.5
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/streams.rb +17 -1
- data/lib/pgbus/version.rb +1 -1
- 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: 2557dc106f7f9c66f1d8cd9aba8b08a984f9777f7c026fc66922b80006dcda92
|
|
4
|
+
data.tar.gz: 2ca250fe0621970c4de8135f3928214d5906b22f6e83d59389b592787b0b1eda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e107b44c7463c408dad493570ad5393b2a2b13fc63b3d9925fbfc0ddfb00f08c3f56eb59fa91a1f6f1959a581b9bc6c6afce45286379f394c9c0b711001a5617
|
|
7
|
+
data.tar.gz: 9e20a794feac0b05270055a66ca6478ff3a7baeb4d845b267d624fc47b0d2038e1a1212a551bbd70ea461ca075728be81389b0e5497f105c0aa608ed7de43724
|
data/lib/pgbus/streams.rb
CHANGED
|
@@ -386,10 +386,26 @@ module Pgbus
|
|
|
386
386
|
# after_commit, so we have to check #open? explicitly — otherwise
|
|
387
387
|
# every call path would hit the "deferred" branch and we'd lose the
|
|
388
388
|
# msg_id return value.
|
|
389
|
+
#
|
|
390
|
+
# The probe must only inspect a connection the calling thread/fiber
|
|
391
|
+
# ALREADY leases — `connection_pool.active_connection?`, never
|
|
392
|
+
# `ActiveRecord::Base.connection`. On Rails 7.2+ `.connection` takes a
|
|
393
|
+
# sticky executor-scoped lease: on a non-executor thread (the
|
|
394
|
+
# Coalescer's flush thread, app worker threads) it is never released —
|
|
395
|
+
# one pool connection pinned per thread — and inside
|
|
396
|
+
# `with_connection` the sticky flag defeats the block-exit release, so
|
|
397
|
+
# the CALLER's connection leaks when its thread dies. Both variants
|
|
398
|
+
# exhausted an exactly-sized pool deterministically (Zazu fan-out
|
|
399
|
+
# incident, 2026-08-05). Semantics are unchanged: a transaction is
|
|
400
|
+
# per-lease, so a thread holding no connection can have no open
|
|
401
|
+
# transaction to defer on — the old code's fresh checkout always
|
|
402
|
+
# answered nil anyway, at the price of the leak.
|
|
389
403
|
def current_open_transaction
|
|
390
404
|
return nil unless defined?(::ActiveRecord::Base)
|
|
391
405
|
|
|
392
|
-
connection = ::ActiveRecord::Base.
|
|
406
|
+
connection = ::ActiveRecord::Base.connection_pool.active_connection?
|
|
407
|
+
return nil unless connection
|
|
408
|
+
|
|
393
409
|
transaction = connection.current_transaction
|
|
394
410
|
transaction if transaction.open?
|
|
395
411
|
rescue StandardError => e
|
data/lib/pgbus/version.rb
CHANGED