Skip to content

Commit

Permalink
maybe reset is the culprit
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Sep 5, 2024
1 parent ec1c5ef commit 342fcb2
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,32 @@ def reset_spatial_store
end
end

conn = SpatialModel.lease_connection.instance_variable_get(:@raw_connection)
$count = conn.conninfo_hash[:port].count(",")+1
# conn = SpatialModel.lease_connection.instance_variable_get(:@raw_connection)
# $count = conn.conninfo_hash[:port].count(",")+1

TracePoint.trace(:call) do |tp|
conn = SpatialModel.lease_connection.instance_variable_get(:@raw_connection)
count = conn.conninfo_hash[:port].count(",")+1
next if count == $count
# TracePoint.trace(:call) do |tp|
# conn = SpatialModel.lease_connection.instance_variable_get(:@raw_connection)
# count = conn.conninfo_hash[:port].count(",")+1
# next if count == $count

$count = count
puts "port(count=#{count}): #{conn.conninfo_hash[:port][0, 100]}"
# $count = count
# puts "port(count=#{count}): #{conn.conninfo_hash[:port][0, 100]}"
# end

module DebugReset
def reset

iopts = conninfo_hash.compact
puts "host count before: #{iopts[:host].count(",") + 1}"
if iopts[:host] && !iopts[:host].empty? && PG.library_version >= 100000
iopts = self.class.send(:resolve_hosts, iopts)
end
puts "host count after: #{iopts[:host].count(",") + 1}"
conninfo = self.class.parse_connect_args( iopts );
reset_start2(conninfo)
async_connect_or_reset(:reset_poll)
self
end
end

PG::Connection.prepend(DebugReset)

0 comments on commit 342fcb2

Please sign in to comment.