Skip to content

Commit 95deab7

Browse files
authored
Merge pull request rails#53826 from byroot/lease-registry-nil-context
Active Record Connection Pool: Don't try to clear unowned connections
2 parents 862ab91 + 7d512c5 commit 95deab7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,9 @@ def acquire_connection(checkout_timeout)
872872
#--
873873
# if owner_thread param is omitted, this must be called in synchronize block
874874
def remove_connection_from_thread_cache(conn, owner_thread = conn.owner)
875-
@leases[owner_thread].clear(conn)
875+
if owner_thread
876+
@leases[owner_thread].clear(conn)
877+
end
876878
end
877879
alias_method :release, :remove_connection_from_thread_cache
878880

0 commit comments

Comments
 (0)