瀏覽代碼

[Minor] Dmarc_report: Try to escape from the coroutines curse

tags/3.0
Vsevolod Stakhov 2 年之前
父節點
當前提交
118452c62f
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8
    3
      lualib/rspamadm/dmarc_report.lua

+ 8
- 3
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)

Loading…
取消
儲存