everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] dtas-tl: speed up prune by pipelining requests
@ 2023-07-03  1:11  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2023-07-03  1:11 UTC (permalink / raw)
  To: dtas-all

We are safely be able to pipeline 10 requests via SOCK_SEQPACKET
on any OS without hitting buffering limits.
---
 bin/dtas-tl | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

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 @@ def add_after(c, argv, last_id)
 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 @@ def add_after(c, argv, last_id)
       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


^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-07-03  1:11  7% [PATCH] dtas-tl: speed up prune by pipelining requests Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/dtas.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).