commit 7a0832ca3ec876e758c8edb7a3287fff95e37ceb
parent c525f80342e835efb1dc830cde24b4a740c524ca
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date: Fri, 2 Apr 2010 23:38:07 -0700
explicit iteration in last_indexed_message
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/sup/mbox.rb b/lib/sup/mbox.rb
@@ -149,7 +149,12 @@ class MBox < Source
## TODO optimize this by iterating over allterms list backwards or
## storing source_info negated
def last_indexed_message
- Enumerator.new(Index, :each_source_info, self.id).map(&:to_i).max
+ max = nil
+ Index.each_source_info(self.id) do |x|
+ x = x.to_i
+ max = x if !max || x > max
+ end
+ max
end
## offset of first new message or nil