diff options
author | Eric Wong <e@80x24.org> | 2023-07-03 01:11:18 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-07-03 02:06:55 +0000 |
commit | 33532b881366989864c9b30fffe046859561bc17 (patch) | |
tree | 98cf52edfedfa3ae0fcba3d7bd212d049ceea919 | |
parent | 93588fe62d15f067dd77f0d7a3f549a4c9e0b89a (diff) | |
download | dtas-33532b881366989864c9b30fffe046859561bc17.tar.gz |
We are safely be able to pipeline 10 requests via SOCK_SEQPACKET on any OS without hitting buffering limits.
-rwxr-xr-x | bin/dtas-tl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/dtas-tl b/bin/dtas-tl index 45a18b5..66e0612 100755 --- a/bin/dtas-tl +++ b/bin/dtas-tl @@ -138,6 +138,8 @@ case cmd = ARGV[0] when 'cat' each_track(c) { |line| print "#{line}\n" } when 'prune' + c2 = nil + pending = 0 each_track(c) do |line| line.sub!(/\A(\d+)=/n, '') or abort "unexpected line=#{line.inspect}\n" track_id = $1.to_i @@ -149,7 +151,19 @@ when 'prune' warn "# #{line}: #{e.class}" # raise other exceptions end - c.req("tl remove #{track_id}") unless ok + unless ok + c2 ||= DTAS::UNIXClient.new + if pending > 5 + c2.res_wait + pending -= 1 + end + pending += 1 + c2.req_start("tl remove #{track_id}") + end + end + while pending > 0 + c2.res_wait + pending -= 1 end when 'aac' # add-after-current ARGV.shift |