From 75e620c365a304857fcf6ec2986982dafe853b58 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 19 Sep 2025 17:20:37 +0200 Subject: [PATCH] global-functions: $WaitForFile: try less expensive operation Checking a specific file is less expensive operation than finding one, especially when on hardware with huge storage and lots of files (like RDS). We have to keep the find command in the latter loop, though. --- global-functions.rsc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/global-functions.rsc b/global-functions.rsc index 10d1b412..98bc306c 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -1787,14 +1787,11 @@ :local Delay ([ $MAX [ $EitherOr $WaitTime 2s ] 100ms ] / 9); :do { - :retry { - :if ([ :len [ /file/find where name=$FileName ] ] = 0) do={ - :error false; - } + :retry { + /file/get $FileName; + :return true; } delay=$Delay max=10; - } on-error={ - :return false; - } + } on-error={ } :while ([ :len [ /file/find where name=$FileName ] ] > 0) do={ :do {