From 634df2f8b26a1439f22dc9f6a23d55a006bf0429 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 31 Jul 2010 02:33:38 -0400 Subject: [PATCH] cmd/save: update the progress meter less often. If you ran 'bup save' in an ssh sessio, you could end up sending huge amounts of data back over ssh *just* to update the progress meter after every single block! Oops. Limit the updates to only about 5 per second, which is much better. --- cmd/save-cmd.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index 59b9cb0..9078455 100755 --- a/cmd/save-cmd.py +++ b/cmd/save-cmd.py @@ -74,8 +74,9 @@ def _pop(force_tree): return tree lastremain = None +lastprint = 0 def progress_report(n): - global count, subcount, lastremain + global count, subcount, lastremain, lastprint subcount += n cc = count + subcount pct = total and (cc*100.0/total) or 0 @@ -107,9 +108,11 @@ def progress_report(n): remainstr = '%dm%d' % (mins, secs) else: remainstr = '%ds' % secs - progress('Saving: %.2f%% (%d/%dk, %d/%d files) %s %s\r' - % (pct, cc/1024, total/1024, fcount, ftotal, - remainstr, kpsstr)) + if now - lastprint > 0.1: + progress('Saving: %.2f%% (%d/%dk, %d/%d files) %s %s\r' + % (pct, cc/1024, total/1024, fcount, ftotal, + remainstr, kpsstr)) + lastprint = now r = index.Reader(git.repo('bupindex')) -- 2.39.2