mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-21 13:57:51 +00:00
Render abbreviated rate and time values
This commit is contained in:
parent
7be1883910
commit
aecd90858a
@ -90,7 +90,7 @@ class UploadResultsRendererMixin(RateAndTimeMixin):
|
||||
|
||||
def _get_time(self, name):
|
||||
d = self.upload_results()
|
||||
d.addCallback(lambda res: str(res.get_timings().get(name)))
|
||||
d.addCallback(lambda res: abbreviate_time(res.get_timings().get(name)))
|
||||
return d
|
||||
|
||||
@renderer
|
||||
@ -138,7 +138,7 @@ class UploadResultsRendererMixin(RateAndTimeMixin):
|
||||
def _convert(r):
|
||||
file_size = r.get_file_size()
|
||||
duration = r.get_timings().get(name)
|
||||
return str(compute_rate(file_size, duration))
|
||||
return abbreviate_rate(compute_rate(file_size, duration))
|
||||
d.addCallback(_convert)
|
||||
return d
|
||||
|
||||
@ -166,9 +166,9 @@ class UploadResultsRendererMixin(RateAndTimeMixin):
|
||||
time1 = r.get_timings().get("cumulative_encoding")
|
||||
time2 = r.get_timings().get("cumulative_sending")
|
||||
if (time1 is None or time2 is None):
|
||||
return str(None)
|
||||
return abbreviate_rate(None)
|
||||
else:
|
||||
return str(compute_rate(file_size, time1+time2))
|
||||
return abbreviate_rate(compute_rate(file_size, time1+time2))
|
||||
d.addCallback(_convert)
|
||||
return d
|
||||
|
||||
@ -178,7 +178,7 @@ class UploadResultsRendererMixin(RateAndTimeMixin):
|
||||
def _convert(r):
|
||||
fetch_size = r.get_ciphertext_fetched()
|
||||
duration = r.get_timings().get("cumulative_fetch")
|
||||
return str(compute_rate(fetch_size, duration))
|
||||
return abbreviate_rate(compute_rate(fetch_size, duration))
|
||||
d.addCallback(_convert)
|
||||
return d
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user