]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix minor fallback directory script issues with time zones
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>
Sat, 27 Feb 2016 09:03:17 +0000 (10:03 +0100)
committerteor (Tim Wilson-Brown) <teor2345@gmail.com>
Sat, 27 Feb 2016 09:03:59 +0000 (10:03 +0100)
scripts/maint/updateFallbackDirs.py

index 884d566bb43a2bd8e51722878ee5f4e04b61aac2..63aaeed267e4b9e7ce4ba6a6a7236cf6e24d3e4f 100755 (executable)
@@ -360,6 +360,7 @@ def onionoo_fetch(what, **kwargs):
     # Check for freshness
     if last_mod < required_freshness:
       if last_mod_date is not None:
+        # This check sometimes fails transiently, retry the script if it does
         date_message = "Outdated data: last updated " + last_mod_date
       else:
         date_message = "No data: never downloaded "
@@ -406,7 +407,7 @@ def fetch(what, **kwargs):
 ## Fallback Candidate Class
 
 class Candidate(object):
-  CUTOFF_ADDRESS_AND_PORT_STABLE = (datetime.datetime.now()
+  CUTOFF_ADDRESS_AND_PORT_STABLE = (datetime.datetime.utcnow()
                             - datetime.timedelta(ADDRESS_AND_PORT_STABLE_DAYS))
 
   def __init__(self, details):
@@ -599,7 +600,7 @@ class Candidate(object):
 
     periods = history.keys()
     periods.sort(key = lambda x: history[x]['interval'])
-    now = datetime.datetime.now()
+    now = datetime.datetime.utcnow()
     newest = now
     for p in periods:
       h = history[p]