aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-05-03 18:36:19 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-05-03 18:36:19 +0100
commit4925e97c7de2560141703460fa62c5036bba680f (patch)
tree2aff74db4a86cebdb8d82bf38cb5683fe546cfd9
parent3241a8e63b2aea5ee624b82d437e9d7bcce4bc1f (diff)
downloadrspamd-4925e97c7de2560141703460fa62c5036bba680f.tar.gz
rspamd-4925e97c7de2560141703460fa62c5036bba680f.zip
[Minor] Clickhouse: Add clock skew protection
-rw-r--r--src/plugins/lua/clickhouse.lua5
1 files changed, 5 insertions, 0 deletions
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),