]> git.cworth.org Git - sup/commitdiff
Merge commit 'origin/scanning-speedups'
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 28 May 2009 14:29:59 +0000 (10:29 -0400)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Thu, 28 May 2009 14:29:59 +0000 (10:29 -0400)
Conflicts:

bin/sup-sync
lib/sup/index.rb

1  2 
bin/sup-sync
lib/sup/index.rb
lib/sup/mbox/loader.rb
lib/sup/message.rb
lib/sup/modes/edit-message-mode.rb
lib/sup/poll.rb

diff --cc bin/sup-sync
index 4a0482a9951e6967999ecf5b56e262edf3f77304,79343e6719b30875570444506feb6838dba3f6cd..9c342d25693f908e26825c3d7c4348e0b5ba84ee
mode 100755,100644..100755
@@@ -184,8 -173,16 +184,16 @@@ begi
          ## nothin! use default source labels
        end
  
+       if Time.now - last_info_time > PROGRESS_UPDATE_INTERVAL
+         last_info_time = Time.now
+         elapsed = last_info_time - start_time
+         pctdone = source.respond_to?(:pct_done) ? source.pct_done : 100.0 * (source.cur_offset.to_f - source.start_offset).to_f / (source.end_offset - source.start_offset).to_f
+         remaining = (100.0 - pctdone) * (elapsed.to_f / pctdone)
+         $stderr.printf "## read %dm (about %.0f%%) @ %.1fm/s. %s elapsed, about %s remaining\n", num_scanned, pctdone, num_scanned / elapsed, elapsed.to_time_s, remaining.to_time_s
+       end
        if index_state.nil?
 -        puts "Adding message #{source}##{offset} with state {#{m.labels * ', '}}" if opts[:verbose]
 +        puts "Adding message #{source}##{offset} from #{m.from} with state {#{m.labels * ', '}}" if opts[:verbose]
          num_added += 1
        else
          puts "Updating message #{source}##{offset}, source #{entry[:source_id]} => #{source.id}, offset #{entry[:source_info]} => #{offset}, state {#{index_state * ', '}} => {#{m.labels * ', '}}" if opts[:verbose]
index 0c62d310d3286499e64361f8c7d14c58932d3e03,c66a24eac428ab7256ea237db16c42e126189dd7..0dae1e0933568e902f39247458d30870c47a26e9
@@@ -409,14 -408,16 +408,16 @@@ EO
          "date" => Time.at(doc[:date].to_i),
          "subject" => unwrap_subj(doc[:subject]),
          "from" => doc[:from],
 -        "to" => doc[:to].split(/\s+/).join(", "), # reformat
 +        "to" => doc[:to].split.join(", "), # reformat
          "message-id" => doc[:message_id],
 -        "references" => doc[:refs].split(/\s+/).map { |x| "<#{x}>" }.join(" "),
 +        "references" => doc[:refs].split.map { |x| "<#{x}>" }.join(" "),
        }
  
-       Message.new :source => source, :source_info => doc[:source_info].to_i,
+       m = Message.new :source => source, :source_info => doc[:source_info].to_i,
 -                  :labels => doc[:label].split(" ").map { |s| s.intern },
 +                  :labels => doc[:label].symbolistize,
-                   :snippet => doc[:snippet], :header => fake_header
+                   :snippet => doc[:snippet]
+       m.parse_header fake_header
+       m
      end
    end
  
Simple merge
Simple merge
Simple merge
diff --cc lib/sup/poll.rb
Simple merge