From 4925e97c7de2560141703460fa62c5036bba680f Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 3 May 2019 18:36:19 +0100 Subject: [PATCH] [Minor] Clickhouse: Add clock skew protection --- src/plugins/lua/clickhouse.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua index 8351989e7..da8c736cc 100644 --- a/src/plugins/lua/clickhouse.lua +++ b/src/plugins/lua/clickhouse.lua @@ -576,6 +576,11 @@ local function clickhouse_collect(task) local scan_real,scan_virtual = task:get_scan_time() scan_real,scan_virtual = math.floor(scan_real * 1000), math.floor(scan_virtual * 1000) + if scan_real < 0 then + rspamd_logger.messagex(task, 'clock skew detected for message: %s ms real scan time (reset to 0), %s virtual scan time', + scan_real, scan_virtual) + scan_real = 0 + end local row = { today(timestamp), -- 2.39.5