Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] sup-sync: show progress for message deletion
@ 2011-01-18 18:24 Sascha Silbe
  2011-01-19  3:39 ` Rich Lane
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Silbe @ 2011-01-18 18:24 UTC (permalink / raw)
  To: sup-devel

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 <sascha-pgp@silbe.org>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [sup-devel] [PATCH] sup-sync: show progress for message deletion
  2011-01-18 18:24 [sup-devel] [PATCH] sup-sync: show progress for message deletion Sascha Silbe
@ 2011-01-19  3:39 ` Rich Lane
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2011-01-19  3:39 UTC (permalink / raw)
  To: Sascha Silbe; +Cc: sup-devel

Applied to master.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-19  3:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-18 18:24 [sup-devel] [PATCH] sup-sync: show progress for message deletion Sascha Silbe
2011-01-19  3:39 ` Rich Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox