From: Vsevolod Stakhov Date: Tue, 26 Jan 2016 23:11:44 +0000 (+0000) Subject: Show slow rules in log X-Git-Tag: 1.1.2~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e89b4ef3b35596ec4862ae4c9bb6995e51073ec5;p=rspamd.git Show slow rules in log --- 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);