From: Vsevolod Stakhov Date: Mon, 16 Aug 2021 09:59:16 +0000 (+0100) Subject: [Minor] Dmarc_report: Improve dates detection X-Git-Tag: 3.0~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=63d7b41dc90d04b82e49d0920c12a2c3bb74dae7;p=rspamd.git [Minor] Dmarc_report: Improve dates detection --- 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',