aboutsummaryrefslogtreecommitdiffstats
path: root/lease-script
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-06-24 17:17:43 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-06-24 22:28:08 +0200
commit407a379f1dd18d12d2cd518cf9be26b69681e164 (patch)
treee714d34bbb74096ec3a4d1f407acf63933fa34ca /lease-script
parent855399b2bc888e592a2a440425fd07430b18f24b (diff)
lease-script: do not run in parallel on simultaneous deassign
Diffstat (limited to 'lease-script')
-rw-r--r--lease-script7
1 files changed, 5 insertions, 2 deletions
diff --git a/lease-script b/lease-script
index b7a4976..eacba9f 100644
--- a/lease-script
+++ b/lease-script
@@ -10,8 +10,9 @@
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
-:global LogPrintExit2;
:global IfThenElse;
+:global LogPrintExit2;
+:global RandomDelay;
:if ([ :typeof $leaseActIP ] = "nothing" || \
[ :typeof $leaseActMAC ] = "nothing" || \
@@ -25,8 +26,10 @@
$LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . \
$State . "ed lease " . $leaseActIP . " to " . $leaseActMAC) false;
-# delay a moment to update the lease table, do not run in parallel for de/assign
+# delay a moment to update the lease table, do not run in parallel for de/assign...
:delay ((1 + $leaseBound) . "s");
+# ... or simultaneous deassign
+$RandomDelay (([ :tonum $leaseBound ] ^ 1) * 750) "ms";
:foreach Script in=[ / system script find where source~("\n# provides: lease-script " . $State . "\n") ] do={
:local ScriptName [ / system script get $Script name ];