mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: $ScriptLock: check for successful removal of ticket
The script is already locked, so there is no second script to remove a ticket at the same time. However a new script can add a new ticket and overwrite the removal... Thus check for successful removal anyway.
This commit is contained in:
@@ -946,13 +946,17 @@
|
||||
|
||||
:global ScriptLockOrder;
|
||||
|
||||
:local New [ :toarray "" ];
|
||||
:foreach Ticket in=($ScriptLockOrder->$Script) do={
|
||||
:if ($Ticket != $Remove) do={
|
||||
:set New ($New, $Ticket);
|
||||
:while (true) do={
|
||||
:local New [ :toarray "" ];
|
||||
:foreach Ticket in=($ScriptLockOrder->$Script) do={
|
||||
:if ($Ticket != $Remove) do={
|
||||
:set New ($New, $Ticket);
|
||||
}
|
||||
}
|
||||
:set ($ScriptLockOrder->$Script) $New;
|
||||
:delay 12ms;
|
||||
:if (($ScriptLockOrder->$Script->0) != $Remove) do={ :return true; }
|
||||
}
|
||||
:set ($ScriptLockOrder->$Script) $New;
|
||||
}
|
||||
|
||||
:if ([ :len [ / system script find where name=$Script ] ] = 0) do={
|
||||
|
||||
Reference in New Issue
Block a user