Gnus development mailing list
 help / color / mirror / Atom feed
From: Jouni K Seppanen <jks@iki.fi>
Subject: Slow expiry with nnimap+Courier [patch]
Date: Wed, 26 Oct 2005 15:41:11 +0300	[thread overview]
Message-ID: <29ll0gpi1k.fsf@itl-pc9.hut.fi> (raw)

[-- Attachment #1: Type: text/plain, Size: 1229 bytes --]

Hi,

I'm using nnimap with a Courier IMAP server (some version from 2004),
and expiry is taking longer and longer; currently exiting my INBOX
(with article numbers in the 6500s, perhaps half of those occupied by
actual articles) takes about 30 seconds. A friend pointed me to
<http://my.gnus.org/book/print/232>, which hints that Courier's UID
SEARCH implementation is sometimes slow.

What Gnus is sending to Courier is something like

  UID SEARCH UID 6512:6513,6515,6519,6526:6528 NOT SINCE 19-Oct-2005

and giving such commands by hand results in a long wait. In
comparison, the commands

  UID SEARCH NOT SINCE 19-Oct-2005
  UID SEARCH SINCE 19-Oct-2005

are almost instantaneous.

So it seems that Courier is doing something very suboptimal with the
Gnus command. The attached patch (against 5.10.6) seems to have
helped: now exiting the INBOX summary takes something like 2 seconds
instead of the previous 30.

I'm not very intimate with Emacs Lisp, Gnus or IMAP, so somebody
should probably check the code (and it looks like
nnimap-request-expire-articles could use some refactoring). However,
it seems to have worked correctly for me in the, um, three times I've
exited a summary buffer this far.

-- 
Jouni K Seppänen


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnimap-search-uids-not-since-is-evil.patch --]
[-- Type: text/x-patch, Size: 1534 bytes --]

--- gnus-5.10.6/lisp/nnimap.el.orig	2003-09-05 01:22:18.000000000 +0300
+++ gnus-5.10.6/lisp/nnimap.el	2005-10-26 15:20:45.366839000 +0300
@@ -312,6 +312,11 @@
 Unlike other backends, you do not need to take special care if you
 flip this variable.")
 
+(defvoo nnimap-search-uids-not-since-is-evil nil
+  "If non-nil, avoid \"UID SEARCH UID ... NOT SINCE\" queries when expiring.
+Instead, use \"UID SEARCH SINCE\" to prune the list of expirable
+articles within Gnus. This seems to be faster on Courier in some cases.")
+
 (defvoo nnimap-expunge-on-close 'always ; 'ask, 'never
   "Whether to expunge a group when it is closed.
 When a IMAP group with articles marked for deletion is closed, this
@@ -1411,6 +1416,21 @@
 			     (gnus-compress-sequence oldarts)) "\\Deleted")
 		       (setq articles (gnus-set-difference
 				       articles oldarts))))))
+		((and nnimap-search-uids-not-since-is-evil (numberp days))
+		 (let* ((all-new-articles 
+			 (gnus-compress-sequence
+			  (imap-search (format "SINCE %s"
+					       (nnimap-date-days-ago days)))))
+			(oldartseq
+			 (gnus-range-difference artseq all-new-articles))
+			(oldarts (gnus-uncompress-range oldartseq)))
+		   (when oldarts
+		     (nnimap-expiry-target oldarts group server)
+		     (when (imap-message-flags-add
+			    (imap-range-to-message-set oldartseq) 
+			    "\\Deleted")
+		       (setq articles (gnus-set-difference
+				       articles oldarts))))))
 		((numberp days)
 		 (let ((oldarts (imap-search
 				 (format nnimap-expunge-search-string

             reply	other threads:[~2005-10-26 12:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-26 12:41 Jouni K Seppanen [this message]
2005-10-27  8:36 ` Simon Josefsson
2005-10-27  9:01   ` Simon Josefsson
2005-10-27 18:44     ` Jouni K Seppanen
2006-12-26 17:59       ` Reiner Steib
2006-12-26 18:11         ` Jouni K. Seppänen
2006-12-29 14:22           ` Jouni K. Seppänen
2006-12-29 15:29             ` Reiner Steib
2006-12-29 16:18               ` Jouni K. Seppänen
2006-12-29 18:09                 ` Reiner Steib
2005-11-01 21:19 ` Ted Zlatanov
2005-11-02 10:22   ` Simon Josefsson
2005-11-04 16:06     ` Ted Zlatanov
2005-11-07  3:10       ` Simon Josefsson
2005-11-07  6:47         ` Jouni K Seppanen
2005-11-07 10:33           ` Bjørn Mork
2005-11-07 20:23             ` Jouni K Seppanen

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=29ll0gpi1k.fsf@itl-pc9.hut.fi \
    --to=jks@iki.fi \
    /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;
as well as URLs for NNTP newsgroup(s).