[tor-commits] [torflow/master] Actually remove stale files.

mikeperry at torproject.org mikeperry at torproject.org
Thu Nov 17 23:50:09 UTC 2011


commit 7bf82544ff04c1755667d12e7c2f966a12c9228d
Author: Mike Perry <mikeperry-git at fscked.org>
Date:   Fri Nov 4 15:13:05 2011 -0700

    Actually remove stale files.
    
    Also kill some dead code.
---
 NetworkScanners/BwAuthority/aggregate.py |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/NetworkScanners/BwAuthority/aggregate.py b/NetworkScanners/BwAuthority/aggregate.py
index 39a2e85..521aee6 100755
--- a/NetworkScanners/BwAuthority/aggregate.py
+++ b/NetworkScanners/BwAuthority/aggregate.py
@@ -13,7 +13,6 @@ from TorCtl import TorCtl,TorUtil
 from TorCtl.PathSupport import VersionRangeRestriction, NodeRestrictionList, NotNodeRestriction
 
 bw_files = []
-timestamps = {}
 nodes = {}
 prev_consensus = {}
 
@@ -280,16 +279,17 @@ def main(argv):
                 # measure hibernating routers for days.
                 # This filter is just to remove REALLY old files
                 if time.time() - timestamp > MAX_AGE:
-                  plog("DEBUG", "Skipping old file "+f)
-                  # FIXME: Unlink this file + sql-
+                  sqlf = f.replace("bws-", "sql-")
+                  plog("INFO", "Removing old file "+f+" and "+sqlf)
+                  os.remove(sr+"/"+f)
+                  try:
+                    os.remove(sr+"/"+sqlf)
+                  except:
+                    pass # In some cases the sql file may not exist
                   continue
                 if timestamp > newest_timestamp:
                   newest_timestamp = timestamp
                 bw_files.append((slicenum, timestamp, sr+"/"+f))
-                # FIXME: Can we kill this?
-                if slicenum not in timestamps or \
-                     timestamps[slicenum] < timestamp:
-                  timestamps[slicenum] = timestamp
           scanner_timestamps[ds] = newest_timestamp
 
   # Need to only use most recent slice-file for each node..





More information about the tor-commits mailing list