global-functions: $WaitForFile: (mostly) revert changes

This (mostly) reverts commits 0e00a228d6
and e08bb2192d.

This is required for RouterOS 7.20beta4. That fixed recursive find for
files, and (again, or still?) suffers timing (and thus racing) issues
getting file properties.

This breaks RouterOS 7.20beta2 again, so that specific version is not
supported. Just update...
This commit is contained in:
Christian Hesse 2025-06-21 23:09:24 +02:00
parent 95f8af6234
commit 6415849850

View file

@ -1771,14 +1771,26 @@
:global MAX;
:set FileName [ $CleanFilePath $FileName ];
:local Delay ([ $MAX [ $EitherOr $WaitTime 2s ] 100ms ] / 10);
:local Delay ([ $MAX [ $EitherOr $WaitTime 2s ] 100ms ] / 9);
:do {
:retry {
:retry {
:if ([ :len [ /file/find where name=$FileName ] ] = 0) do={
:error false;
}
} delay=$Delay max=10;
} on-error={
:return false;
}
:while ([ :len [ /file/find where name=$FileName ] ] > 0) do={
:do {
/file/get $FileName;
:return true;
} delay=$Delay max=10;
} on-error={ }
} on-error={ }
:delay $Delay;
:set Delay ($Delay * 3 / 2);
}
:return false;
}