]> source.dussan.org Git - rspamd.git/commitdiff
Improve performance of trie search.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 10 Jun 2011 14:34:05 +0000 (18:34 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 10 Jun 2011 14:34:05 +0000 (18:34 +0400)
src/plugins/lua/multimap.lua
src/plugins/lua/trie.lua

index 8a0596115f37fd6e657d6bdb5cd6c52ffe0f376f..548cc2ea69cde5ab69909d8e5027458f62fe48d9 100644 (file)
@@ -50,7 +50,7 @@ function check_multimap(task)
                                end
                        else
                                local ip = task:get_from_ip_num()
-                               if ip and rule['ips']:get_key(ip) then
+                               if ip and rule['ips'] and rule['ips']:get_key(ip) then
                                        task:insert_result(rule['symbol'], 1)
                                end
                        end
index 152935d8b97d3d360359b75eedfb952188b467db..65524745c9d75ec453ee172e6f74eb12d8a6d1e3 100644 (file)
@@ -65,6 +65,7 @@ function check_trie(task)
        for _,trie in ipairs(tries) do
                if trie['trie']:search_task(task) then
                        task:insert_result(trie['symbol'], 1)
+                       return
                end
                -- Search inside urls
                urls = task:get_urls()
@@ -72,6 +73,7 @@ function check_trie(task)
                        for _,url in ipairs(urls) do
                                if trie['trie']:search_text(url:get_text()) then
                                        task:insert_result(trie['symbol'], 1)
+                                       return
                                end
                        end
                end