lib/httpx/selector.rb in httpx-0.9.0 vs lib/httpx/selector.rb in httpx-0.10.0
- old
+ new
@@ -49,11 +49,11 @@
private
READ_INTERESTS = %i[r rw].freeze
WRITE_INTERESTS = %i[w rw].freeze
- def select_many(interval)
+ def select_many(interval, &block)
selectables, r, w = nil
# first, we group IOs based on interest type. On call to #interests however,
# things might already happen, and new IOs might be registered, so we might
# have to start all over again. We do this until we group all selectables
@@ -100,12 +100,10 @@
# so that we don't yield 2 times
writers.delete(io)
end if readers
- writers.each do |io|
- yield io
- end if writers
+ writers.each(&block) if writers
end
def select_one(interval)
io = @selectables.first