From d628e9bd3c5ef42e44c8e14f8eaf9a85dd541a4c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 13 Dec 2015 12:44:21 +0000 Subject: player: reduce I/O priority of connected clients Do not batch processing of requests or buffered output. We cannot have clients running "dtas-tl cat" or similar to dump a gigantic playlist cause us to have gaps in our playback. Since we implemented a tunable tracklist limit, we can also remove the hardcoded 100 element limit for buffered messages while we're at it; now the tracklist limit affects maximum memory use. --- lib/dtas/unix_accepted.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/dtas/unix_accepted.rb b/lib/dtas/unix_accepted.rb index 7db3ed5..e683fb2 100644 --- a/lib/dtas/unix_accepted.rb +++ b/lib/dtas/unix_accepted.rb @@ -21,8 +21,6 @@ class DTAS::UNIXAccepted # :nodoc: when :wait_writable then @send_buf << msg end rv - elsif buffered > 100 - RuntimeError.new("too many messages buffered") else # buffered > 0 @send_buf << msg :wait_writable @@ -37,8 +35,8 @@ class DTAS::UNIXAccepted # :nodoc: when :wait_writable then return :wait_writable else @send_buf.shift - end until @send_buf.empty? - :wait_readable + @send_buf.empty? ? :wait_readable : :wait_writable + end rescue => e e end @@ -54,9 +52,8 @@ class DTAS::UNIXAccepted # :nodoc: when '', nil then return nil # EOF else yield(self, msg) # DTAS::Player deals with this - nread = @to_io.nread - end while nread > 0 - :wait_readable + end + @send_buf.empty? ? :wait_readable : :wait_writable rescue SystemCallError nil end -- cgit v1.2.3-24-ge0c7