From 8bea663fb26e71bf84a7a127ce68fcfc4d2e8cc5 Mon Sep 17 00:00:00 2001 From: Brian Warner <warner@allmydata.com> Date: Mon, 14 Apr 2008 14:16:38 -0700 Subject: [PATCH] offloaded: add fetched-percentage to the log message --- src/allmydata/offloaded.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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): -- 2.45.2