Only check the incoming files for deletion once per day to save a lot of file accesses.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sat, 4 Sep 2010 21:48:42 +0000 (23:48 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sat, 4 Sep 2010 21:48:42 +0000 (23:48 +0200)
lisp/ChangeLog
lisp/mail-source.el

index 811cad1..72f482c 100644 (file)
@@ -1,5 +1,9 @@
 2010-09-04  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * mail-source.el (mail-source-delete-crash-box): Only check the
+       incoming files for deletion once per day to save a lot of file
+       accesses.
+
        * pop3.el (pop3-logon): Fix up unbound variable typo.
 
        * mail-source.el (pop3-streaming-movemail): Autoload.
index 422ef31..080433c 100644 (file)
@@ -624,11 +624,20 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff bfile)
        0)
     (funcall callback mail-source-crash-box info)))
 
+(defvar mail-source-incoming-last-checked-time nil)
+
 (defun mail-source-delete-crash-box ()
   (when (file-exists-p mail-source-crash-box)
     ;; Delete or move the incoming mail out of the way.
     (if (eq mail-source-delete-incoming t)
        (delete-file mail-source-crash-box)
+      ;; Don't check for old incoming files more than once per day to
+      ;; save a lot of file accesses.
+      (when (or (null mail-source-incoming-last-checked-time)
+               (> (time-to-seconds
+                   (time-since mail-source-incoming-last-checked-time))
+                  (* 24 60 60)))
+       (setq mail-source-incoming-last-checked-time (current-time)))
       (let ((incoming
             (mm-make-temp-file
              (expand-file-name