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.
This commit is contained in:
Christian Hesse 2025-09-19 17:20:37 +02:00
parent 7a790b88c0
commit 75e620c365

View file

@ -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 {