aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-26 23:11:44 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-26 23:11:44 +0000
commite89b4ef3b35596ec4862ae4c9bb6995e51073ec5 (patch)
tree6eb42c436de20261f78db44de0e27ccd37fc0541
parent1eae6d3402ad2c0dcc3c8b4e4a757714211ac72f (diff)
downloadrspamd-e89b4ef3b35596ec4862ae4c9bb6995e51073ec5.tar.gz
rspamd-e89b4ef3b35596ec4862ae4c9bb6995e51073ec5.zip
Show slow rules in log
-rw-r--r--src/libserver/symbols_cache.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index ab95c6e61..d030e5c9d 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -1038,6 +1038,7 @@ rspamd_symbols_cache_check_symbol (struct rspamd_task *task,
struct rspamd_task **ptask;
lua_State *L;
gboolean check = TRUE;
+ const gdouble slow_diff_limit = 1e5;
if (item->type & (SYMBOL_TYPE_NORMAL|SYMBOL_TYPE_CALLBACK)) {
@@ -1080,6 +1081,11 @@ rspamd_symbols_cache_check_symbol (struct rspamd_task *task,
*total_diff += diff;
}
+ if (diff > slow_diff_limit) {
+ msg_info_task ("slow rule: %s: %d ms", item->symbol,
+ (gint)(diff / 1000.));
+ }
+
rspamd_set_counter (item, diff);
rspamd_session_watch_stop (task->s);
pending_after = rspamd_session_events_pending (task->s);