From: wmorgan Date: Wed, 14 Feb 2007 05:31:31 +0000 (+0000) Subject: bugfixes for imap polling X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=63b383205a92ceab003cd355dd3b8f19cc8e0ef7;p=sup bugfixes for imap polling git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@329 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/bin/sup-import b/bin/sup-import index f5de3c2..9deb3c2 100644 --- a/bin/sup-import +++ b/bin/sup-import @@ -98,7 +98,7 @@ begin elapsed = last_update - start 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) - puts "## #{num} (#{pctdone}% done) read; #{elapsed.to_time_s} elapsed; est. #{remaining.to_time_s} remaining" + puts "## #{num_added + num_updated} (#{pctdone}% done) read; #{elapsed.to_time_s} elapsed; est. #{remaining.to_time_s} remaining" end ## update if... @@ -145,7 +145,7 @@ if opts[:rebuild] || opts[:full_rebuild] # puts "got #{mid}" next if found[mid] puts "Deleting #{mid}" if opts[:verbose] - index.index.delete docid + #index.index.delete docid numdel += 1 end end diff --git a/lib/sup/modes/inbox-mode.rb b/lib/sup/modes/inbox-mode.rb index c651988..37ed26d 100644 --- a/lib/sup/modes/inbox-mode.rb +++ b/lib/sup/modes/inbox-mode.rb @@ -21,7 +21,10 @@ class InboxMode < ThreadIndexMode end def multi_archive threads - threads.each { |t| remove_label_and_hide_thread t, :inbox } + threads.each do |t| + t.remove_label :inbox + hide_thread t + end regen_text end diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb index 6a17409..8914d1d 100644 --- a/lib/sup/poll.rb +++ b/lib/sup/poll.rb @@ -92,24 +92,28 @@ class PollManager labels.each { |l| LabelManager << l } - m = Message.new :source => source, :source_info => offset, :labels => labels - if m.source_marked_read? - m.remove_label :unread - labels.delete :unread - end + begin + m = Message.new :source => source, :source_info => offset, :labels => labels + if m.source_marked_read? + m.remove_label :unread + labels.delete :unread + end - docid, entry = Index.load_entry_for_id m.id - m = yield m, offset, entry - next unless m - if entry - Index.update_message m, docid, entry - else - Index.add_message m - UpdateManager.relay self, :add, m + docid, entry = Index.load_entry_for_id m.id + m = yield m, offset, entry + next unless m + if entry + Index.update_message m, docid, entry + else + Index.add_message m + UpdateManager.relay self, :add, m + end + rescue MessageFormatError, SourceError => e + Redwood::log "ignoring erroneous message at #{source}##{offset}: #{e.message}" end end - rescue MessageFormatError, SourceError => e - Redwood::log "found problem with #{source}: #{e.message}" + rescue SourceError => e + Redwood::log "problem getting messages from #{source}: #{e.message}" end end end