[tor-commits] [depictor/master] Download from authorities in serial

tom at torproject.org tom at torproject.org
Thu Nov 5 22:27:56 UTC 2015


commit 53739518034d04b271fc810fd7d5f862e909f0b4
Author: Tom Ritter <tom at ritter.vg>
Date:   Thu Nov 5 16:25:41 2015 -0600

    Download from authorities in serial
    
    This mirrors doctor's patch here: https://gitweb.torproject.org/doctor.git/commit/?id=b2772926bbf9b5f1565b07be96faf053f64bda71
    Downloading from authorities in parallell is throwing off the download times.  It will take a week to get correct times into the page though...
---
 write_website.py |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/write_website.py b/write_website.py
index 9346d3e..a160e54 100755
--- a/write_website.py
+++ b/write_website.py
@@ -115,28 +115,27 @@ def get_votes():
 
 
 def _get_documents(label, resource):
-	queries, documents, issues, runtimes = {}, {}, [], {}
+	documents, issues, runtimes = {}, [], {}
 
 	for authority in directory_authorities().values():
 		if authority.v3ident is None:
 			continue	# not a voting authority
 
-		queries[authority.nickname] = downloader.query(
+		query = downloader.query(
 			resource,
 			endpoints = [(authority.address, authority.dir_port)],
 			default_params = False,
 		)
 
-	for authority, query in queries.items():
 		try:
-			result = query.run()
-			documents[authority] = result[0]
-			runtimes[authority] = query.runtime
+			start_time = time.time()
+			documents[authority.nickname] = query.run()[0]
+			runtimes[authority.nickname] = time.time() - start_time
 		except Exception, exc:
 			if label == 'vote':
 				# try to download the vote via the other authorities
 
-				v3ident = directory_authorities()[authority].v3ident
+				v3ident = directory_authorities()[authority.nickname].v3ident
 
 				query = downloader.query(
 					'/tor/status-vote/current/%s' % v3ident,
@@ -146,7 +145,7 @@ def _get_documents(label, resource):
 				query.run(True)
 
 				if not query.error:
-					documents[authority] = list(query)[0]
+					documents[authority.nickname] = list(query)[0]
 					continue
 
 			issues.append(('AUTHORITY_UNAVAILABLE', label, authority, query.download_url, exc))



More information about the tor-commits mailing list