From 805b59fb08970c19b38f45e494c6ba4e5fdd302f Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 18 Jan 2014 23:52:49 -0500 Subject: [PATCH] Correct handling when we run out of _get_revision_content() retries. --- tasks/afc_statistics.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tasks/afc_statistics.py b/tasks/afc_statistics.py index f3f7578..070f385 100644 --- a/tasks/afc_statistics.py +++ b/tasks/afc_statistics.py @@ -519,9 +519,10 @@ class AFCStatistics(Task): try: content = res["query"]["pages"].values()[0]["revisions"][0]["*"] except KeyError: - if tries > 0: - sleep(5) - return self._get_revision_content(revid, tries=tries - 1) + if tries == 0: + raise KeyError() + sleep(5) + return self._get_revision_content(revid, tries=tries - 1) self.revision_cache[revid] = content return content