aboutsummaryrefslogtreecommitdiffstats
path: root/mod/notification-email.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-12-11 11:51:17 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-12-17 11:20:09 +0100
commit8c8c75ca66d59d9368fe3f4fe7f1124a425f41b3 (patch)
tree944ffbf73089be7621c34dbaf66a2da73c210b3a /mod/notification-email.rsc
parent1e2ca3d21441ac7881b7c556c8d73c70bb92edc6 (diff)
mod/notification-email: $FlushEmailQueue: move the check up...
... as this needs to be done before creating a scheduler. 😜 Also remove the scheduler and return.
Diffstat (limited to 'mod/notification-email.rsc')
-rw-r--r--mod/notification-email.rsc10
1 files changed, 6 insertions, 4 deletions
diff --git a/mod/notification-email.rsc b/mod/notification-email.rsc
index c474750..bbce6d0 100644
--- a/mod/notification-email.rsc
+++ b/mod/notification-email.rsc
@@ -47,6 +47,12 @@
:local QueueLen [ :len $EmailQueue ];
:local Scheduler [ /system/scheduler/find where name="_FlushEmailQueue" ];
+ :if ([ :len $Scheduler ] > 0 && $QueueLen = 0) do={
+ $LogPrint warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.");
+ /system/scheduler/remove $Scheduler;
+ :return false;
+ }
+
:if ([ :len $Scheduler ] < 0) do={
/system/scheduler/add name="_FlushEmailQueue" interval=1m start-time=startup \
comment="Doing initial checks..." on-event=(":global FlushEmailQueue; \$FlushEmailQueue;");
@@ -74,10 +80,6 @@
:return false;
}
- :if ([ :len $Scheduler ] > 0 && $QueueLen = 0) do={
- $LogPrint warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.");
- }
-
/system/scheduler/set interval=($QueueLen . "m") comment="Sending..." $Scheduler;
:foreach Id,Message in=$EmailQueue do={