From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.42.229.71 with SMTP id jh7cs147122icb; Tue, 18 Jan 2011 11:24:29 -0800 (PST) Received: by 10.224.45.77 with SMTP id d13mr5615712qaf.56.1295378669444; Tue, 18 Jan 2011 11:24:29 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id t4si12361796qco.17.2011.01.18.11.24.28; Tue, 18 Jan 2011 11:24:29 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 8B15F1858378; Tue, 18 Jan 2011 14:24:14 -0500 (EST) Received: from smtp.chost.de (setoy.chost.de [217.160.209.225]) by rubyforge.org (Postfix) with ESMTP id 8AE7E185831A for ; Tue, 18 Jan 2011 13:24:55 -0500 (EST) Received: (qmail 30015 invoked by uid 5015); 18 Jan 2011 18:25:03 -0000 Received: (nullmailer pid 31433 invoked by uid 8193); Tue, 18 Jan 2011 18:24:54 -0000 Received: (nullmailer pid 2274 invoked by uid 8193); Tue, 18 Jan 2011 18:24:51 -0000 From: Sascha Silbe To: sup-devel Date: Tue, 18 Jan 2011 19:24:42 +0100 Message-Id: <1295375082-2236-1-git-send-email-sascha-pgp@silbe.org> X-Mailer: git-send-email 1.7.2.3 Mail-Followup-To: Subject: [sup-devel] [PATCH] sup-sync: show progress for message deletion X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sascha Silbe , Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org When moving lots of messages across folders, deleting can take a lot of time so we should display progress information for deletion. Signed-off-by: Sascha Silbe --- bin/sup-sync | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bin/sup-sync b/bin/sup-sync index 33e4925..1d1fda1 100755 --- a/bin/sup-sync +++ b/bin/sup-sync @@ -117,14 +117,15 @@ begin sources.each do |source| puts "Scanning #{source}..." - num_added = num_updated = num_scanned = num_restored = 0 + num_added = num_updated = num_deleted = num_scanned = num_restored = 0 last_info_time = start_time = Time.now Redwood::PollManager.poll_from source do |action,m,old_m,progress| + num_scanned += 1 if action == :delete + num_deleted += 1 puts "Deleting #{m.id}" elsif action == :add - num_scanned += 1 seen[m.id] = true ## tweak source labels according to commandline arguments if necessary @@ -172,20 +173,20 @@ begin puts "Changing flags for #{source}##{m.source_info} from #{old_m.labels} to #{m.labels}" if opts[:verbose] num_updated += 1 end - - if Time.now - last_info_time > PROGRESS_UPDATE_INTERVAL - last_info_time = Time.now - elapsed = last_info_time - start_time - pctdone = progress * 100.0 - remaining = (100.0 - pctdone) * (elapsed.to_f / pctdone) - printf "## read %dm (~%.0f%%) @ %.1fm/s. %s elapsed, ~%s remaining\n", num_scanned, pctdone, num_scanned / elapsed, elapsed.to_time_s, remaining.to_time_s - end else fail end + + if Time.now - last_info_time > PROGRESS_UPDATE_INTERVAL + last_info_time = Time.now + elapsed = last_info_time - start_time + pctdone = progress * 100.0 + remaining = (100.0 - pctdone) * (elapsed.to_f / pctdone) + printf "## scanned %dm (~%.0f%%) @ %.1fm/s. %s elapsed, ~%s remaining\n", num_scanned, pctdone, num_scanned / elapsed, elapsed.to_time_s, remaining.to_time_s + end next if opts[:dry_run] end - puts "Scanned #{num_scanned}, added #{num_added}, updated #{num_updated} messages from #{source}." + puts "Scanned #{num_scanned}, added #{num_added}, updated #{num_updated}, deleted #{num_deleted} messages from #{source}." puts "Restored state on #{num_restored} (#{100.0 * num_restored / num_scanned}%) messages." if num_restored > 0 end -- 1.7.2.3 _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel