]> source.dussan.org Git - rspamd.git/commitdiff
Show slow rules in log
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Jan 2016 23:11:44 +0000 (23:11 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Jan 2016 23:11:44 +0000 (23:11 +0000)
src/libserver/symbols_cache.c

index ab95c6e6120546cb2f1c797757cf3296bb63e041..d030e5c9d0c082be61b31861ebc8be9bfdf24653 100644 (file)
@@ -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);