mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-08-03 17:54:47 +02:00
global-functions: $WaitForFile: (mostly) revert changes
This (mostly) reverts commits0e00a228d6
ande08bb2192d
. 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:
parent
95f8af6234
commit
6415849850
1 changed files with 16 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue