Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: steve.shreeve@gmail.com (Steve Shreeve)
Subject: [sup-talk] Question regarding Maildir (and possible patch?)
Date: Sat, 6 Oct 2007 01:34:55 -0700	[thread overview]
Message-ID: <001601c807f3$c6bafe10$650aa8c0@ocean> (raw)

Sup looks great!

Tonight, I tried to configure it for a pretty large Maildir setup (about 250,000 messages and nearly 1,500 mailboxes for one user). When I went to import (ie - index) these messages, it failed. As I looked into it, I realized that sup was only looking at the top-level Maildir cur and new folders for messages. In my dovecot setup, each mailbox has it's own subdirectory, containing its own Maildir cur and new directories. Since it seems sup is only looking at the top-level Maildir cur and new directories, none of my mailboxes are indexed. Since I prefer not to manually add all 1,500 mailboxes as "sources" for sup, I modified maildir.rb as follows to allow sup to dive into mailboxes.

I've not fully tested this (it's still indexing messages!), but I wanted to check to see if this approach is okay or ill advised.

Cheers,

Steve



==[ maildir.rb ]==

+ require 'find'

  def scan_mailbox
    return if @last_scan && (Time.now - @last_scan) < SCAN_INTERVAL

-   cdir = File.join(@dir, 'cur')
-   ndir = File.join(@dir, 'new')

-   raise FatalSourceError, "#{cdir} not a directory" unless File.directory? cdir
-   raise FatalSourceError, "#{ndir} not a directory" unless File.directory? ndir
+   raise FatalSourceError, "#{@dir} not a directory" unless File.directory? @dir

    begin
      @ids, @ids_to_fns = @mutex.synchronize do
        ids, ids_to_fns = [], {}
-       (Dir[File.join(cdir, "*")] + Dir[File.join(ndir, "*")]).map do |fn|
+       Find.find(@dir) do |fn|
+         next unless File.file?(fn)
+         next unless File.basename(File.dirname(fn)) =~ /^cur|new$/
          id = make_id fn
          ids << id
          ids_to_fns[id] = fn
        end
        [ids.sort, ids_to_fns]
      end
    rescue SystemCallError, IOError => e
      raise FatalSourceError, "Problem scanning Maildir directories: #{e.message}."
    end

    @last_scan = Time.now
  end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/sup-talk/attachments/20071006/eef0d815/attachment-0001.html 


             reply	other threads:[~2007-10-06  8:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-06  8:34 Steve Shreeve [this message]
2007-10-08 21:26 ` William Morgan

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='001601c807f3$c6bafe10$650aa8c0@ocean' \
    --to=steve.shreeve@gmail.com \
    /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