[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sup-devel] [PATCH] Handle drafts with high ID numbers.
From: "Edward Z. Yang" <ezyang@mit.edu>
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
---
lib/sup/draft.rb | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/lib/sup/draft.rb b/lib/sup/draft.rb
index 58c45db..1f33dc1 100644
--- a/lib/sup/draft.rb
+++ b/lib/sup/draft.rb
@@ -37,7 +37,6 @@ class DraftLoader < Source
Dir.mkdir dir unless File.exists? dir
super DraftManager.source_name, true, false
@dir = dir
- @cur_offset = 0
end
def id; DraftManager.source_id; end
@@ -46,14 +45,13 @@ class DraftLoader < Source
def poll
ids = get_ids
- ids.each do |id|
- if id >= @cur_offset
- @cur_offset = id + 1
- yield :add,
- :info => id,
- :labels => [:draft, :inbox],
- :progress => 0.0
- end
+ old_ids = Enumerator.new(Index.instance, :each_source_info, self.id).to_a
+ new_ids = ids - old_ids
+ new_ids.each do |id|
+ yield :add,
+ :info => id,
+ :labels => [:draft, :inbox],
+ :progress => 0.0
end
end
--
1.7.11.3
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel