From 2773fef9d80fe8f7e2abdec767da5c5dcb64ddaf 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 10d1b41..98bc306 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 {