Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: "Edward Z. Yang" <ezyang@MIT.EDU>
To: sup-devel <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] [PATCH] Inotify support for Maildirs. (FIRST DRAFT)
Date: Mon, 03 Sep 2012 19:31:28 -0400	[thread overview]
Message-ID: <1346714661-sup-2638@javelin> (raw)
In-Reply-To: <1346695742-sup-7650@javelin>

Extra note: the ruby-inotify plugin appears to be braindead
on at least Ruby 1.8.7 for Ubuntu Precise, and will spin-loop.  If
sup is chomping 15% CPU on idle, try this patch on ruby-inotify

Reported here: https://github.com/ruby-building-blocks/ruby-inotify/issues/8

diff --git a/lib/inotify/inotify_native.rb b/lib/inotify/inotify_native.rb
index 66db2b4..27d1043 100644
--- a/lib/inotify/inotify_native.rb
+++ b/lib/inotify/inotify_native.rb
@@ -115,7 +115,7 @@ require 'ffi'
     # each_event() provides an easy way to loop over all events as they occur
     def each_event
       loop do
-        ready = IO.select([@io], nil, nil, nil)
+        ready = IO.select([@io])
         event = self.read_event
         yield event
       end


Excerpts from Edward Z. Yang's message of Mon Sep 03 14:09:57 -0400 2012:
> 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


  parent reply	other threads:[~2012-09-03 23:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21 15:17 [sup-devel] inotify support for Maildir mailboxes Edward Z. Yang
2012-08-21 16:00 ` Alvaro Herrera
2012-09-03  4:59   ` [sup-devel] [PATCH] Inotify support for Maildirs. (FIRST DRAFT) Edward Z. Yang
2012-09-03  5:00     ` Edward Z. Yang
2012-09-03 16:02       ` Alvaro Herrera
2012-09-03 16:07         ` Alvaro Herrera
2012-09-03 16:10           ` ezyang
2012-09-03 18:09             ` Edward Z. Yang
2012-09-03 18:29               ` Edward Z. Yang
2012-09-03 18:42                 ` Alvaro Herrera
2012-09-03 18:49                   ` Edward Z. Yang
2012-09-03 19:27                   ` Edward Z. Yang
2012-09-03 23:31               ` Edward Z. Yang [this message]
2012-09-04 16:06                 ` Edward Z. Yang
2012-09-04 18:09                   ` Alvaro Herrera

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=1346714661-sup-2638@javelin \
    --to=ezyang@mit.edu \
    --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