aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-08-09 16:38:07 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-08-09 16:38:07 +0100
commit118452c62ff48eed45fdf7b1732f85fc0775287a (patch)
tree154e60323181cba1ef86ff2eeb03efc201dff951 /lualib/rspamadm
parenta64af2fa4a875bcaca257f55e63b7445692294b9 (diff)
downloadrspamd-118452c62ff48eed45fdf7b1732f85fc0775287a.tar.gz
rspamd-118452c62ff48eed45fdf7b1732f85fc0775287a.zip
[Minor] Dmarc_report: Try to escape from the coroutines curse
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r--lualib/rspamadm/dmarc_report.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/lualib/rspamadm/dmarc_report.lua b/lualib/rspamadm/dmarc_report.lua
index 062e8070e..acc941400 100644
--- a/lualib/rspamadm/dmarc_report.lua
+++ b/lualib/rspamadm/dmarc_report.lua
@@ -685,14 +685,19 @@ local function handler(args)
local function finish_cb(nsuccess, nfail)
if not opts.no_opt then
lua_util.debugm(N, 'set last report date to %s', os.time())
+ -- Hack to avoid coroutines + async functions mess: we use async redis call here
+ redis_attrs.callback = function()
+ logger.messagex('Reporting collection has finished %s dates processed, %s reports: %s completed, %s failed',
+ ndates, nreports, nsuccess, nfail)
+ end
lua_redis.request(redis_params, redis_attrs,
{'SETEX', 'rspamd_dmarc_last_collection', dmarc_settings.reporting.keys_expire,
tostring(os.time())})
+ else
+ logger.messagex('Reporting collection has finished %s dates processed, %s reports: %s completed, %s failed',
+ ndates, nreports, nsuccess, nfail)
end
- logger.messagex('Reporting collection has finished %s dates processed, %s reports: %s completed, %s failed',
- ndates, nreports, nsuccess, nfail)
-
pool:destroy()
end
send_reports_by_smtp(opts, all_reports, finish_cb)