aboutsummaryrefslogtreecommitdiffstats
path: root/mod/notification-email
diff options
context:
space:
mode:
Diffstat (limited to 'mod/notification-email')
-rw-r--r--mod/notification-email9
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;
}
}