]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Clickhouse: Add clock skew protection
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 3 May 2019 17:36:19 +0000 (18:36 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 3 May 2019 17:36:19 +0000 (18:36 +0100)
src/plugins/lua/clickhouse.lua

index 8351989e75d53f34394c6deb6e259356d7960531..da8c736cc84e48c69d5aba50053c7b6a8ccd1b0e 100644 (file)
@@ -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),