lib/httpx/selector.rb in httpx-0.20.1 vs lib/httpx/selector.rb in httpx-0.20.2

- old
+ new

@@ -72,11 +72,14 @@ # TODO: what to do if there are no selectables? readers, writers = IO.select(r, w, nil, interval) - raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") if readers.nil? && writers.nil? && interval + if readers.nil? && writers.nil? && interval + [*r, *w].each { |io| io.raise_timeout_error(interval) } + return + end rescue IOError, SystemCallError @selectables.reject!(&:closed?) retry end @@ -106,10 +109,14 @@ when :w then io.to_io.wait_writable(interval) when :rw then io.to_io.wait(interval, :read_write) when nil then return end - raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") unless result || interval.nil? + unless result || interval.nil? + io.raise_timeout_error(interval) + return + end + # raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") yield io rescue IOError, SystemCallError @selectables.reject!(&:closed?) raise unless @selectables.empty?