aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-02-02 11:05:16 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-02-02 11:20:14 +0100
commit978c03131a905c1a6892c9d2fbb049256af2c263 (patch)
tree7a10ac2ab6d280b03d508fec42756c8341bc8139 /global-functions
parentb794d98cbb513f7ef49ffd4e19101e4580e96949 (diff)
global-functions: $WaitForFile: use delay instead of iterations
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions11
1 files changed, 6 insertions, 5 deletions
diff --git a/global-functions b/global-functions
index 2f57fae..d2f911e 100644
--- a/global-functions
+++ b/global-functions
@@ -1213,20 +1213,21 @@
# wait for file to be available
:set WaitForFile do={
- :local FileName [ :tostr $1 ];
- :local Iter [ :tonum $2 ];
+ :local FileName [ :tostr $1 ];
+ :local WaitTime [ :totime $2 ];
:global CleanFilePath;
:global EitherOr;
:set FileName [ $CleanFilePath $FileName ];
- :local I 0;
+ :local I 1;
+ :local Delay ([ :totime [ $EitherOr $WaitTime 2s ] ] / 20);
:while ([ :len [ /file/find where name=$FileName ] ] = 0) do={
- :if ($I > [ $EitherOr $Iter 20 ]) do={
+ :if ($I >= 20) do={
:return false;
}
- :delay 100ms;
+ :delay $Delay;
:set I ($I + 1);
}
:return true;