@@ -136,14 +136,32 @@ def reset_spatial_store
136
136
end
137
137
end
138
138
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
141
141
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
146
146
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
149
165
end
166
+
167
+ PG ::Connection . prepend ( DebugReset )
0 commit comments