From f2457513399799a5183f00738081a606efd39afc Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 15 Sep 2022 21:49:06 +0200 Subject: global-functions: $FlushEmailQueue: do not flush with resolver issues Flushing the mail queue with resolver issues can flood the log with messages like: e-mail;error Error sending e-mail <=?utf-8?Q?[MikroTik] =F0=9F=92=BE=E2=98=81 Cloud backup?=>: DNS resolve failed Try to avoid this... --- global-functions | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/global-functions b/global-functions index df286b5..8d8ac1c 100644 --- a/global-functions +++ b/global-functions @@ -323,6 +323,7 @@ :global EmailQueue; :global EitherOr; + :global IsDNSResolving; :global IsTimeSync; :global LogPrintExit2; @@ -334,6 +335,11 @@ :return false; } + :if ([ :typeof [ :toip [ /tool/e-mail/get address ] ] ] != "ip" && [ $IsDNSResolving ] = false) do={ + $LogPrintExit2 debug $0 ("Server address is a DNS name and resolving fails, not flushing.") false; + :return false; + } + :if ([ :len [ /system/scheduler/find where name="FlushEmailQueue" ] ] > 0 && $QueueLen = 0) do={ $LogPrintExit2 warning $0 ("Flushing E-Mail messages from scheduler, but queue is empty.") false; } -- cgit v1.2.3-70-g09d2