From: Brian Warner Date: Mon, 14 Apr 2008 21:16:38 +0000 (-0700) Subject: offloaded: add fetched-percentage to the log message X-Git-Url: https://git.rkrishnan.org/pf/content/en/service/module-simplejson.encoder.html?a=commitdiff_plain;h=8bea663fb26e71bf84a7a127ce68fcfc4d2e8cc5;p=tahoe-lafs%2Ftahoe-lafs.git offloaded: add fetched-percentage to the log message --- diff --git a/src/allmydata/offloaded.py b/src/allmydata/offloaded.py index dd6acaec..03dcfeea 100644 --- a/src/allmydata/offloaded.py +++ b/src/allmydata/offloaded.py @@ -366,10 +366,15 @@ class CHKCiphertextFetcher(AskUntilSuccessMixin): fetch_size = min(needed, self.CHUNK_SIZE) if fetch_size == 0: return True # all done - self.log(format="fetching %(start)d-%(end)d of %(total)d", + percent = 0 + if self._expected_size: + percent = 1.0 * (self._have+fetch_size) / self._expected_size + percent = int(100*percent) + self.log(format="fetching %(start)d-%(end)d of %(total)d (%(percent)d%%)", start=self._have, end=self._have+fetch_size, total=self._expected_size, + percent=percent, level=log.NOISY) d = self.call("read_encrypted", self._have, fetch_size) def _got_data(ciphertext_v):