diff options
author | Christian Hesse <mail@eworm.de> | 2022-11-22 21:09:27 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-11-22 21:27:51 +0100 |
commit | ab3047ee8210831bd26dfc36df8ed00368c540c0 (patch) | |
tree | ddf5b62406d84c7329c35b30fb60fbe88d39c636 /mod | |
parent | c2a29da9f2fe48ad1cf028efaa02b4bfdae8504b (diff) |
mod/notification-email: reference scheduler from variable
Diffstat (limited to 'mod')
-rw-r--r-- | mod/notification-email | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mod/notification-email b/mod/notification-email index 264a154..ea2c40b 100644 --- a/mod/notification-email +++ b/mod/notification-email @@ -19,6 +19,7 @@ :local AllDone true; :local QueueLen [ :len $EmailQueue ]; + :local Scheduler [ /system/scheduler/find where name=$0 ]; :if ([ /tool/e-mail/get last-status ] = "in-progress") do={ $LogPrintExit2 debug $0 ("Sending mail is currently in progress, not flushing.") false; @@ -35,11 +36,11 @@ :return false; } - :if ([ :len [ /system/scheduler/find where name=$0 ] ] > 0 && $QueueLen = 0) do={ + :if ([ :len $Scheduler ] > 0 && $QueueLen = 0) do={ $LogPrintExit2 warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.") false; } - /system/scheduler/set interval=([ $EitherOr $QueueLen 1 ] . "m") [ find where name=$0 ]; + /system/scheduler/set interval=([ $EitherOr $QueueLen 1 ] . "m") $Scheduler; :foreach Id,Message in=$EmailQueue do={ :if ([ :typeof $Message ] = "array" ) do={ @@ -76,10 +77,10 @@ } :if ($AllDone = true && $QueueLen = [ :len $EmailQueue ]) do={ - /system/scheduler/remove [ find where name=$0 ]; + /system/scheduler/remove $Scheduler; :set EmailQueue; } else={ - /system/scheduler/set interval=1m [ find where name=$0 ]; + /system/scheduler/set interval=1m $Scheduler; } } |