Optimize analysis using reverse loop

This commit is contained in:
Gregory Soutade
2014-12-14 15:10:13 +01:00
parent 9da4eb3858
commit 3a246d5cd6
6 changed files with 26 additions and 28 deletions

View File

@@ -109,15 +109,14 @@ class IWLAPostAnalysisReferers(IPlugin):
key_phrases = month_stats.get('key_phrases', {})
for (k, super_hit) in stats.items():
for r in super_hit['requests']:
if not self.iwla.isValidForCurrentAnalysis(r): continue
for r in super_hit['requests'][::-1]:
if not self.iwla.isValidForCurrentAnalysis(r): break
if not r['http_referer']: continue
uri = r['extract_referer']['extract_uri']
is_search_engine = False
if self.own_domain_re.match(uri): continue
is_search_engine = False
for (name, engine) in self.search_engines.items():
for (hashid, hashid_re) in engine['hashid']:
if not hashid_re.match(uri): continue