aboutsummaryrefslogtreecommitdiffstats
path: root/mod/notification-email.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-12-11 11:28:12 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-12-17 11:20:09 +0100
commit1e2ca3d21441ac7881b7c556c8d73c70bb92edc6 (patch)
tree68d1d7523a20b33f93312f51a1e309fd5bf50853 /mod/notification-email.rsc
parent53106731528adc607ee40336b79c516fac594a17 (diff)
mod/notification-email: $FlushEmailQueue: create scheduler if missing...
... as it is required to be modified several times below.
Diffstat (limited to 'mod/notification-email.rsc')
-rw-r--r--mod/notification-email.rsc10
1 files changed, 8 insertions, 2 deletions
diff --git a/mod/notification-email.rsc b/mod/notification-email.rsc
index 60c1e9b..c474750 100644
--- a/mod/notification-email.rsc
+++ b/mod/notification-email.rsc
@@ -46,9 +46,15 @@
:local AllDone true;
:local QueueLen [ :len $EmailQueue ];
:local Scheduler [ /system/scheduler/find where name="_FlushEmailQueue" ];
- :local SchedVal [ /system/scheduler/get $Scheduler ];
- :if ([ :len $Scheduler ] > 0 && ($SchedVal->"interval") < 1m) do={
+ :if ([ :len $Scheduler ] < 0) do={
+ /system/scheduler/add name="_FlushEmailQueue" interval=1m start-time=startup \
+ comment="Doing initial checks..." on-event=(":global FlushEmailQueue; \$FlushEmailQueue;");
+ :set Scheduler [ /system/scheduler/find where name="_FlushEmailQueue" ];
+ }
+
+ :local SchedVal [ /system/scheduler/get $Scheduler ];
+ :if (($SchedVal->"interval") < 1m) do={
/system/scheduler/set interval=1m comment="Doing initial checks..." $Scheduler;
}