lib/elastic_apm/transport/connection/http.rb in elastic-apm-4.6.0 vs lib/elastic_apm/transport/connection/http.rb in elastic-apm-4.6.1

- old
+ new

@@ -73,12 +73,20 @@ debug '%s: Closing request with reason %s', thread_str, reason @closed.make_true @wr&.close - return if @request.nil? || @request&.join(5) + if @request&.join(5) + @rd&.close + return + end + + @rd&.close + + return if @request.nil? + error( '%s: APM Server not responding in time, terminating request', thread_str ) @request.kill @@ -115,11 +123,9 @@ end rescue Exception => e error( "Couldn't establish connection to APM Server:\n%p", e.inspect ) - ensure - @rd&.close end end end def build_client