Increased performance on IMAP verify.

This commit is contained in:
Thorsten Eckel 2014-11-09 21:10:23 +01:00
parent 3698bb24c5
commit fb8f2799ff

View file

@ -37,9 +37,17 @@ class Channel::IMAP < Channel::EmailParser
elsif check_type == 'verify' elsif check_type == 'verify'
puts "verify mode, fetch no emails #{verify_string}" puts "verify mode, fetch no emails #{verify_string}"
end end
count = 0
count_all = @imap.search(['ALL']).count message_ids = @imap.search(['ALL'])
@imap.search(['ALL']).each do |message_id| count_all = message_ids.count
count = 0
# reverse message order to increase performance
if check_type == 'verify'
message_ids.reverse!
end
message_ids.each do |message_id|
count += 1 count += 1
puts " - message #{count.to_s}/#{count_all.to_s}" puts " - message #{count.to_s}/#{count_all.to_s}"
# puts msg.to_s # puts msg.to_s