[gnus git] branch master updated: n0-17-38-g592dfba =1= Use a prune factor when pruning the registry over the hard limit, instead of 10.

Ted Zlatanov <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  592dfba56d49972352096210e3c7f251e9d9f63b (commit)
      from  f16fd3138546268f54cecb4ad4a6268e0b13e98f (commit)


- Log -----------------------------------------------------------------
commit 592dfba56d49972352096210e3c7f251e9d9f63b
Author: Ted Zlatanov <[email protected]>
Date:   Thu May 12 23:05:01 2011 -0500

    Use a prune factor when pruning the registry over the hard limit, instead of 10.
    
    * gnus-registry.el (gnus-registry-fixup-registry): Set prune-factor to
    0.1 expicitly.
    
    * registry.el (prune-factor): New initialization parameter defaulting
    to 0.1.
    (registry-prune-hard): Use it.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ae4bfad..60182e1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
+2011-05-13  Teodor Zlatanov  <[email protected]>
+
+	* registry.el (prune-factor): New initialization parameter defaulting
+	to 0.1.
+	(registry-prune-hard): Use it.
+
+	* gnus-registry.el (gnus-registry-fixup-registry): Set prune-factor to
+	0.1 expicitly.
+
 2011-05-13  Glenn Morris  <[email protected]>
 
 	* message.el (message-send-mail-with-sendmail): Assume sendmail-program
diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el
index 02e4ce7..25d84b1 100644
--- a/lisp/gnus-registry.el
+++ b/lisp/gnus-registry.el
@@ -244,6 +244,8 @@ the Bit Bucket."
       (oset db :max-hard
             (or gnus-registry-max-entries
                 most-positive-fixnum))
+      (oset db :prune-factor
+            0.1)
       (oset db :max-soft
             (or gnus-registry-max-pruned-entries
                 most-positive-fixnum))
diff --git a/lisp/registry.el b/lisp/registry.el
index b5cc3ec..8e158f7 100644
--- a/lisp/registry.el
+++ b/lisp/registry.el
@@ -116,6 +116,12 @@
              :type integer
              :custom integer
              :documentation "Prune as much as possible to get to this size.")
+   (prune-factor
+    :initarg :prune-factor
+    :initform 0.1
+    :type float
+    :custom float
+    :documentation "At the max-hard limit, prune size * this entries.")
    (tracked :initarg :tracked
             :initform nil
             :type t
@@ -357,11 +363,12 @@ Proposes only entries without the :precious keys."
 
   (defmethod registry-prune-hard-candidates ((db registry-db))
     "Collects pruning candidates from the registry-db object THIS.
-Proposes any entries over the max-hard limit minus 10."
+Proposes any entries over the max-hard limit minus size * prune-factor."
     (let* ((data (oref db :data))
-           ;; prune to 10 below the max-hard limit so we're not
-           ;; pruning all the time
-	   (limit (- (oref db :max-hard) 10))
+           ;; prune to (size * prune-factor) below the max-hard limit so
+           ;; we're not pruning all the time
+	   (limit (max 0 (- (oref db :max-hard)
+                            (* (registry-size db) (oref db :prune-factor)))))
 	   (candidates (loop for k being the hash-keys of data
 			     collect k)))
       (list limit candidates))))

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog        |    9 +++++++++
 lisp/gnus-registry.el |    2 ++
 lisp/registry.el      |   15 +++++++++++----
 3 files changed, 22 insertions(+), 4 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.