diff options
author | Christian Hesse <mail@eworm.de> | 2021-12-09 22:28:06 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2021-12-09 22:48:30 +0100 |
commit | b423e6ed0f382ecdfd24e0b7b6d8e3dc4b43fede (patch) | |
tree | 58fee591ce3edf2781d16f48075d01da14d8cde6 | |
parent | 327740d25592c12c17bb9b87a853cc86abc4548a (diff) |
global-functions: $ScriptLock: cleanup in dedicated function
-rw-r--r-- | global-functions | 17 |
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; } |