Gnus development mailing list
 help / color / mirror / Atom feed
* Slow expiry with nnimap+Courier [patch]
@ 2005-10-26 12:41 Jouni K Seppanen
  2005-10-27  8:36 ` Simon Josefsson
  2005-11-01 21:19 ` Ted Zlatanov
  0 siblings, 2 replies; 17+ messages in thread
From: Jouni K Seppanen @ 2005-10-26 12:41 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2006-12-29 18:09 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-26 12:41 Slow expiry with nnimap+Courier [patch] Jouni K Seppanen
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

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).