aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-12-09 22:28:06 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-12-09 22:48:30 +0100
commitb423e6ed0f382ecdfd24e0b7b6d8e3dc4b43fede (patch)
tree58fee591ce3edf2781d16f48075d01da14d8cde6 /global-functions
parent327740d25592c12c17bb9b87a853cc86abc4548a (diff)
global-functions: $ScriptLock: cleanup in dedicated function
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions17
1 files changed, 13 insertions, 4 deletions
diff --git a/global-functions b/global-functions
index f5682be..ce538f3 100644
--- a/global-functions
+++ b/global-functions
@@ -945,18 +945,26 @@
:global ScriptLockOrder;
- :local Count 0;
:foreach Id,Ticket in=($ScriptLockOrder->$Script) do={
:if (($ScriptLockOrder->$Script->$Id) = $Remove) do={
:set ($ScriptLockOrder->$Script->$Id);
}
+ }
+ }
- :if ([ :typeof ($ScriptLockOrder->$Script->$Id) ] != "nothing") do={
- :set Count ($Count + 1);
+ :local CleanupTickets do={
+ :local Script [ :tostr $1 ];
+
+ :global ScriptLockOrder;
+
+ :local Clean true;
+ :foreach Ticket in=($ScriptLockOrder->$Script) do={
+ :if ([ :typeof $Ticket ] != "nothing") do={
+ :set Clean false;
}
}
- :if ($Count = 0) do={
+ :if ($Clean = true) do={
:set ($ScriptLockOrder->$Script) [ :toarray "" ];
}
}
@@ -986,6 +994,7 @@
:if ([ $IsFirstTicket $Script $MyTicket ] = true && [ $TicketCount $Script ] = [ $JobCount $Script ]) do={
$RemoveTicket $Script $MyTicket;
+ $CleanupTickets $Script;
:return false;
}