From 51d6307b45ae62cf6040cb1faa590f8a0ccdfcf4 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Wed, 8 Jul 2020 13:08:19 -0400 Subject: [PATCH] Fail better when timings data isn't available --- src/allmydata/web/status.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/allmydata/web/status.py b/src/allmydata/web/status.py index 5d0b2a861..b2e54f8cf 100644 --- a/src/allmydata/web/status.py +++ b/src/allmydata/web/status.py @@ -707,7 +707,9 @@ class DownloadStatusElement(Element): return tag(str(self.download_results().file_size)) def _get_time(self, name): - return self.download_results().timings.get(name) + if self.download_results().timings: + return self.download_results().timings.get(name) + return None @renderer def time_total(self, req, tag): @@ -748,7 +750,9 @@ class DownloadStatusElement(Element): def _get_rate(self, name): r = self.download_results() file_size = r.file_size - duration = r.timings.get(name) + duration = None + if r.timings: + duration = r.timings.get(name) return compute_rate(file_size, duration) @renderer