[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sup-devel] [PATCH] Inotify support for Maildirs. (FIRST DRAFT)
OK, cracked a fix; you need this extra patch:
commit f9ea07f3c4982ab46d8171fdba8eabc3af00c840
Author: Edward Z. Yang <ezyang@mit.edu>
Date: Mon Sep 3 14:09:34 2012 -0400
sync_back after writing to index, not before.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
diff --git a/lib/sup/index.rb b/lib/sup/index.rb
index 13798d6..4b533a7 100644
--- a/lib/sup/index.rb
+++ b/lib/sup/index.rb
@@ -657,10 +657,6 @@ EOS
end
def sync_message m, overwrite
- ## TODO: we should not save the message if the sync_back failed
- ## since it would overwrite the location field
- m.sync_back
-
doc = synchronize { find_doc(m.id) }
existed = doc != nil
doc ||= Xapian::Document.new
@@ -703,6 +699,10 @@ EOS
@xapian.replace_document docid, doc
end
+ # sync_back must be after label update, so that inotify gets
+ # fresh data from the index
+ m.sync_back
+
m.labels.each { |l| LabelManager << l }
true
end
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel