lease-script: do not run in parallel on simultaneous deassign

This commit is contained in:
Christian Hesse 2021-06-24 17:17:43 +02:00
parent 855399b2bc
commit 407a379f1d

View file

@ -10,8 +10,9 @@
:global GlobalFunctionsReady; :global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; } :while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:global LogPrintExit2;
:global IfThenElse; :global IfThenElse;
:global LogPrintExit2;
:global RandomDelay;
:if ([ :typeof $leaseActIP ] = "nothing" || \ :if ([ :typeof $leaseActIP ] = "nothing" || \
[ :typeof $leaseActMAC ] = "nothing" || \ [ :typeof $leaseActMAC ] = "nothing" || \
@ -25,8 +26,10 @@
$LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . \ $LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . \
$State . "ed lease " . $leaseActIP . " to " . $leaseActMAC) false; $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"); :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={ :foreach Script in=[ / system script find where source~("\n# provides: lease-script " . $State . "\n") ] do={
:local ScriptName [ / system script get $Script name ]; :local ScriptName [ / system script get $Script name ];