From: wmorgan Date: Sat, 10 Feb 2007 16:29:27 +0000 (+0000) Subject: poll tweaks X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=b45108bb0fa37b2005c384654f9b2a2cbd0a0c3e;p=sup poll tweaks git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@312 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/bin/sup-import b/bin/sup-import index 68ffd76..d4efa10 100644 --- a/bin/sup-import +++ b/bin/sup-import @@ -107,8 +107,8 @@ begin m elsif opts[:full_rebuild] || # we're updating everyone; or (opts[:rebuild] && (entry[:source_id].to_i != source.id || entry[:source_info].to_i != offset)) # we're updating just the changed ones - puts "# updating message at #{offset}, #{m.from.inspect}, #{m.subj.inspect}, source #{entry[:source_id]} => #{source.id}, offset #{entry[:source_info]} => #{offset}, labels: #{m.labels * ' '}" if opts[:verbose] - num += 1 + puts "# updating message at #{offset} (from #{m.from.longname} subject \"#{m.subj}\"), source #{entry[:source_id]} => #{source.id}, offset #{entry[:source_info]} => #{offset}, labels: {#{m.labels * ', '}}" if opts[:verbose] + num += 1 unless found[m.id] m else nil diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index cbad96c..f7c73bd 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -41,7 +41,6 @@ class PollManager def do_poll total_num = total_numi = 0 @mutex.synchronize do - found = {} Index.usual_sources.each do |source| # yield "source #{source} is done? #{source.done?} (cur_offset #{source.cur_offset} >= #{source.end_offset})" yield "Loading from #{source}... " unless source.done? || source.broken? @@ -50,7 +49,7 @@ class PollManager add_new_messages_from source do |m, offset, entry| ## always preserve the labels on disk. m.labels = entry[:label].split(/\s+/).map { |x| x.intern } if entry - yield "Found message at #{offset} with labels #{m.labels * ', '}" + yield "Found message at #{offset} with labels {#{m.labels * ', '}}" num += 1 numi += 1 if m.labels.include? :inbox m @@ -80,7 +79,6 @@ class PollManager ## labels, if they exist, so that state is not lost when e.g. a new ## version of a message from a mailing list comes in. def add_new_messages_from source - found = {} return if source.done? || source.broken? source.each do |offset, labels| @@ -93,13 +91,6 @@ class PollManager begin m = Message.new :source => source, :source_info => offset, :labels => labels - if found[m.id] - Redwood::log "skipping duplicate message #{m.id}" - next - else - found[m.id] = true - end - if m.source_marked_read? m.remove_label :unread labels.delete :unread