From: William Morgan Date: Thu, 28 May 2009 14:29:59 +0000 (-0400) Subject: Merge commit 'origin/scanning-speedups' X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=3439894f38d1d4140bb912de0232fdb576991de0;p=sup Merge commit 'origin/scanning-speedups' Conflicts: bin/sup-sync lib/sup/index.rb --- 3439894f38d1d4140bb912de0232fdb576991de0 diff --cc bin/sup-sync index 4a0482a,79343e6..9c342d2 mode 100755,100644..100755 --- a/bin/sup-sync +++ b/bin/sup-sync @@@ -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] diff --cc lib/sup/index.rb index 0c62d31,c66a24e..0dae1e0 --- a/lib/sup/index.rb +++ b/lib/sup/index.rb @@@ -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