about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/dtas/buffer/read_write.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/dtas/buffer/read_write.rb b/lib/dtas/buffer/read_write.rb
index 530a08d..08dfb01 100644
--- a/lib/dtas/buffer/read_write.rb
+++ b/lib/dtas/buffer/read_write.rb
@@ -41,8 +41,7 @@ module DTAS::Buffer::ReadWrite # :nodoc:
   end
 
   def broadcast_inf(targets)
-    bytes = inflight
-    nr_nb = targets.count { |sink| sink.nonblock? }
+    nr_nb = targets.count(&:nonblock?)
     if nr_nb == 0 || nr_nb == targets.size
       # if all targets are full, don't start until they're all writable
       r = IO.select(nil, targets, nil, 0) or return targets
@@ -59,6 +58,7 @@ module DTAS::Buffer::ReadWrite # :nodoc:
     again = {}
 
     # don't pin too much on one target
+    bytes = inflight
     bytes = bytes > MAX_AT_ONCE ? MAX_AT_ONCE : bytes
     buf = _rbuf
     @to_io.read(bytes, buf)