]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Properly place timers calculations
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 12 Apr 2016 10:00:42 +0000 (11:00 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 12 Apr 2016 10:00:42 +0000 (11:00 +0100)
src/libserver/re_cache.c

index 67dd58b23c8127d1370a19ffd71b3fd0ff06a103..c2e628206dd930e1e1cbccf50e25ca425b6044a1 100644 (file)
@@ -481,9 +481,9 @@ rspamd_re_cache_process_pcre (struct rspamd_re_runtime *rt,
 
        r = rt->results[id];
 
-       t1 = rspamd_get_ticks ();
-
        if (max_hits == 0 || r < max_hits) {
+               t1 = rspamd_get_ticks ();
+
                while (rspamd_regexp_search (re,
                                in,
                                len,
@@ -505,13 +505,13 @@ rspamd_re_cache_process_pcre (struct rspamd_re_runtime *rt,
                if (r > 0) {
                        rt->stat.regexp_matched += r;
                }
-       }
 
-       t2 = rspamd_get_ticks ();
+               t2 = rspamd_get_ticks ();
 
-       if (t2 - t1 > slow_time) {
-               msg_info_pool ("regexp '%16s' took %.2f seconds to execute",
-                               rspamd_regexp_get_pattern (re), t2 - t1);
+               if (t2 - t1 > slow_time) {
+                       msg_info_pool ("regexp '%16s' took %.2f seconds to execute",
+                                       rspamd_regexp_get_pattern (re), t2 - t1);
+               }
        }
 
        return r;