From: "Edward Z. Yang" <ezyang@MIT.EDU>
To: sup-devel@rubyforge.org
Cc: btricha@gmail.com
Subject: [sup-devel] [PATCH] Handle drafts with high ID numbers.
Date: Tue, 28 Aug 2012 20:35:01 -0400 [thread overview]
Message-ID: <1346200502-27650-1-git-send-email-ezyang@mit.edu> (raw)
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
next reply other threads:[~2012-08-29 0:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-29 0:35 Edward Z. Yang [this message]
2012-08-29 0:41 ` Edward Z. Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346200502-27650-1-git-send-email-ezyang@mit.edu \
--to=ezyang@mit.edu \
--cc=btricha@gmail.com \
--cc=sup-devel@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox