Skip to content

Commit 342fcb2

Browse files
committed
maybe reset is the culprit
1 parent ec1c5ef commit 342fcb2

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

test/test_helper.rb

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,32 @@ def reset_spatial_store
136136
end
137137
end
138138

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

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

147-
$count = count
148-
puts "port(count=#{count}): #{conn.conninfo_hash[:port][0, 100]}"
147+
# $count = count
148+
# puts "port(count=#{count}): #{conn.conninfo_hash[:port][0, 100]}"
149+
# end
150+
151+
module DebugReset
152+
def reset
153+
154+
iopts = conninfo_hash.compact
155+
puts "host count before: #{iopts[:host].count(",") + 1}"
156+
if iopts[:host] && !iopts[:host].empty? && PG.library_version >= 100000
157+
iopts = self.class.send(:resolve_hosts, iopts)
158+
end
159+
puts "host count after: #{iopts[:host].count(",") + 1}"
160+
conninfo = self.class.parse_connect_args( iopts );
161+
reset_start2(conninfo)
162+
async_connect_or_reset(:reset_poll)
163+
self
164+
end
149165
end
166+
167+
PG::Connection.prepend(DebugReset)

0 commit comments

Comments
 (0)