selector: jump out of the loop if there's nothing to wait on

This commit is contained in:
HoneyryderChuck 2021-02-19 16:17:40 +00:00
parent 825dcf867b
commit a050b5a403

View File

@ -69,6 +69,11 @@ class HTTPX::Selector
if @selectables.empty?
@selectables = selectables
# do not run event loop if there's nothing to wait on.
# this might happen if connect failed and connection was unregistered.
return if (!r || r.empty?) && (!w || w.empty?)
break
else
@selectables = [*selectables, @selectables]