mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-06-20 17:15:48 +02:00
global-functions: $WaitForFile: use :retry for simplification, ...
... and to work around restrictions in new file handling.
This commit is contained in:
parent
e08bb2192d
commit
0e00a228d6
1 changed files with 6 additions and 8 deletions
|
@ -1746,16 +1746,14 @@
|
|||
:global MAX;
|
||||
|
||||
:set FileName [ $CleanFilePath $FileName ];
|
||||
:local I 1;
|
||||
:local Delay ([ $MAX [ $EitherOr $WaitTime 2s ] 100ms ] / 10);
|
||||
|
||||
:while ([ :len [ /file/find where name=$FileName ] ] = 0) do={
|
||||
:if ($I >= 10) do={
|
||||
:return false;
|
||||
}
|
||||
:delay $Delay;
|
||||
:set I ($I + 1);
|
||||
}
|
||||
:do {
|
||||
:retry {
|
||||
/file/get $FileName;
|
||||
:return true;
|
||||
} delay=$Delay max=10;
|
||||
} on-error={ }
|
||||
|
||||
:return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue