From: Vsevolod Stakhov Date: Fri, 10 Jun 2011 14:34:05 +0000 (+0400) Subject: Improve performance of trie search. X-Git-Tag: 0.3.14~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d6ff0ee6444a52bba805f0746ed795d68b56fb8a;p=rspamd.git Improve performance of trie search. --- diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 8a0596115..548cc2ea6 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -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 diff --git a/src/plugins/lua/trie.lua b/src/plugins/lua/trie.lua index 152935d8b..65524745c 100644 --- a/src/plugins/lua/trie.lua +++ b/src/plugins/lua/trie.lua @@ -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