mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 21:43:09 +00:00
Fail better when timings data isn't available
This commit is contained in:
parent
112cfc1da5
commit
51d6307b45
@ -707,7 +707,9 @@ class DownloadStatusElement(Element):
|
||||
return tag(str(self.download_results().file_size))
|
||||
|
||||
def _get_time(self, name):
|
||||
if self.download_results().timings:
|
||||
return self.download_results().timings.get(name)
|
||||
return None
|
||||
|
||||
@renderer
|
||||
def time_total(self, req, tag):
|
||||
@ -748,6 +750,8 @@ class DownloadStatusElement(Element):
|
||||
def _get_rate(self, name):
|
||||
r = self.download_results()
|
||||
file_size = r.file_size
|
||||
duration = None
|
||||
if r.timings:
|
||||
duration = r.timings.get(name)
|
||||
return compute_rate(file_size, duration)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user