Skip to content

Commit 77d3024

Browse files
committed
purge old collections
1 parent 61e0eec commit 77d3024

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

geovis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def populateNames(remoteip,res):
3838
return res
3939

4040
def iterateViableConnections():
41+
now=time.time()
4142
for id,conn in connections.getConnections().items():
4243

4344
#TODO: keep gone for a while (if space)
@@ -47,6 +48,8 @@ def iterateViableConnections():
4748
continue
4849

4950
lastEventTime = conn.get("gone") or conn.get("lastActivity")
51+
if now-lastEventTime>60*5:
52+
continue
5053

5154
homeip = connections.getHomeIPFromConnection(conn)
5255
remoteip = conn.get("dst")

sanvis.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,18 @@ def addLink(s,name,hitcount,actualtargets,v=1,last_act=0):
6060
link_count=0
6161
candidates={}
6262
name_hits={}
63+
64+
now=time.time()
6365
for id,conn in connections.getConnections().items():
6466

6567
#TODO: keep gone for a while (if space)
6668
if conn.get("gone"):
6769
continue
6870
if conn.get("state") and conn["state"]!="ESTABLISHED":
6971
continue
72+
lastEventTime = conn.get("gone") or conn.get("lastActivity")
73+
if now-lastEventTime>60*5:
74+
continue
7075

7176
#TODO: packetIn gets swapped also if this istrue
7277
homeip = connections.getHomeIPFromConnection(conn)
@@ -178,7 +183,7 @@ def addLink(s,name,hitcount,actualtargets,v=1,last_act=0):
178183
if namePopularity[name]>1:
179184
final_count+=1
180185

181-
# OOPS: If we try finding common links and there none then show at least something (TODO: sort by target freshness)
186+
# OOPS: If we try finding common links and there none then show at least something (TODO: sort by target freshness and only show 25 targets instead of reducing to only common targets)
182187
if final_count<1:
183188
ONLY_COMMON_LINKS=False
184189
final_count=link_count

0 commit comments

Comments
 (0)