From 407a379f1dd18d12d2cd518cf9be26b69681e164 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 24 Jun 2021 17:17:43 +0200 Subject: lease-script: do not run in parallel on simultaneous deassign --- lease-script | 7 +++++-- 1 file 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 ]; -- cgit v1.2.3-70-g09d2