commit 63d7b41: [Minor] Dmarc_report: Improve dates detection

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Aug 16 10:28:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-08-16 10:59:16 +0100
URL: https://github.com/rspamd/rspamd/commit/63d7b41dc90d04b82e49d0920c12a2c3bb74dae7

[Minor] Dmarc_report: Improve dates detection

---
 lualib/rspamadm/dmarc_report.lua | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lualib/rspamadm/dmarc_report.lua b/lualib/rspamadm/dmarc_report.lua
index acc941400..b6811df98 100644
--- a/lualib/rspamadm/dmarc_report.lua
+++ b/lualib/rspamadm/dmarc_report.lua
@@ -663,7 +663,12 @@ local function handler(args)
   lua_util.debugm(N, 'previous last report date is %s', start_time)
 
   if not opts.date or #opts.date == 0 then
-    opts.date = {os.date('!%Y%m%d', os.time())}
+    local now = os.time()
+    opts.date = {}
+    while now >= start_time do
+      table.insert(opts.date, os.date('!%Y%m%d', now))
+      now = now - 86400
+    end
   end
 
   local ndates = 0
@@ -691,7 +696,7 @@ local function handler(args)
             ndates, nreports, nsuccess, nfail)
       end
       lua_redis.request(redis_params, redis_attrs,
-          {'SETEX', 'rspamd_dmarc_last_collection', dmarc_settings.reporting.keys_expire,
+          {'SETEX', 'rspamd_dmarc_last_collection', dmarc_settings.reporting.keys_expire * 2,
            tostring(os.time())})
     else
       logger.messagex('Reporting collection has finished %s dates processed, %s reports: %s completed, %s failed',


More information about the Commits mailing list