From acd7d5c52c044f0cd78276517ff2454801d56a43 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Sun, 9 Nov 2014 21:18:13 +0100 Subject: [PATCH] Increased performance on POP3 verify. --- app/models/channel/pop3.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/channel/pop3.rb b/app/models/channel/pop3.rb index 95ceac95b..9d6a47641 100644 --- a/app/models/channel/pop3.rb +++ b/app/models/channel/pop3.rb @@ -26,9 +26,17 @@ class Channel::POP3 < Channel::EmailParser elsif check_type == 'verify' puts "verify mode, fetch no emails" end + + mails = @pop.mails count = 0 - count_all = @pop.mails.size - @pop.each_mail do |m| + count_all = mails.size + + # reverse message order to increase performance + if check_type == 'verify' + mails.reverse! + end + + mails.each do |m| count += 1 puts " - message #{count.to_s}/#{count_all.to_s}"