From 63d7b41dc90d04b82e49d0920c12a2c3bb74dae7 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 16 Aug 2021 10:59:16 +0100 Subject: [PATCH] [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', -- 2.39.5