From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 2CD3F1F953 for ; Tue, 30 Nov 2021 06:02:37 +0000 (UTC) Received: from localhost ([::1]:46966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrwDr-0002X8-MO for e@80x24.org; Tue, 30 Nov 2021 01:02:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrwDT-0002Wg-GA for dtas-all@nongnu.org; Tue, 30 Nov 2021 01:02:17 -0500 Received: from dcvr.yhbt.net ([64.71.152.64]:39024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrwDR-0000YW-Te for dtas-all@nongnu.org; Tue, 30 Nov 2021 01:02:11 -0500 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7D1601F953 for ; Tue, 30 Nov 2021 06:02:05 +0000 (UTC) From: Eric Wong To: dtas-all@nongnu.org Subject: [PATCH] readahead: scan tracklist properly Date: Tue, 30 Nov 2021 06:02:05 +0000 Message-Id: <20211130060205.6883-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=64.71.152.64; envelope-from=e@80x24.org; helo=dcvr.yhbt.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: duct tape audio suite List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+e=80x24.org@nongnu.org Sender: "dtas-all" Ensure we skip the current track when performing readahead, otherwise it was getting stuck on the current track. --- bin/dtas-readahead | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/dtas-readahead b/bin/dtas-readahead index 3eedd86..a9d5733 100755 --- a/bin/dtas-readahead +++ b/bin/dtas-readahead @@ -157,11 +157,12 @@ def do_open(path) t0 = DTAS.now fp = nil cur = YAML.load(c.req('current')) + current_track = nil while @todo_ra > 0 && fp.nil? if current = cur['current'] track = current['infile'] break unless track.kind_of?(String) - track.freeze + current_track = track.freeze fp = work[track] ||= do_open(track) cur_pid = current['pid'] if fp @@ -181,6 +182,7 @@ def do_open(path) queue = YAML.load(c.req('queue cat')) while @todo_ra > 0 && track = queue.shift next unless track.kind_of?(String) + next if current_track == track.freeze fp = nil begin fp = work[track] ||= do_open(track) @@ -199,12 +201,14 @@ def do_open(path) while @todo_ra > 0 && idx && (cid = ids[idx]) fp = nil track = c.req("tl get #{cid}").sub!(/\A1 \d+=/, '').freeze - begin - fp = work[track] ||= do_open(track) - rescue SystemCallError + if current_track != track + begin + fp = work[track] ||= do_open(track) + rescue SystemCallError + end + fp = do_ra(fp, 0, w) if fp + work.delete_if { |_, io| io.closed? } end - fp = do_ra(fp, 0, w) if fp - work.delete_if { |_, io| io.closed? } if @todo_ra > 0 && fp.nil? && ids[idx += 1].nil? idx = repeat == 'true' ? 0 : nil end