[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [metrics-utils/master 3/4] Don't add duplicate ExitAddress lines.
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Thu, 25 Nov 2010 19:43:24 +0100
Subject: Don't add duplicate ExitAddress lines.
Commit: 414c26249246088fe6d5ebc7fb72398430d3f97a
---
visitor/visitor.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/visitor/visitor.py b/visitor/visitor.py
index 466bd52..39cd50e 100644
--- a/visitor/visitor.py
+++ b/visitor/visitor.py
@@ -51,7 +51,9 @@ def get_exitlist(exitlist_filepath):
yr, mo, d, h, m, s, _, _, _ = strptime(dt.rstrip('\s\n'), '%Y-%m-%d %H:%M:%S')
if not ip in exitlist:
exitlist[ip] = []
- bisect.insort(exitlist[ip], datetime(yr, mo, d, h, m, s)) # maintain ordered list
+ timestamp = datetime(yr, mo, d, h, m, s)
+ if not timestamp in exitlist[ip]:
+ bisect.insort(exitlist[ip], timestamp) # maintain ordered list
except IOError:
print >> sys.stderr, 'could not open %s. Skipping it.'%fn
--
1.7.1