Commit 652aa465 authored by Ted Zlatanov's avatar Ted Zlatanov Committed by Katsumi Yamaoka
Browse files

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.
parent f0dd243b
2011-05-13 Teodor Zlatanov <tzz@lifelogs.com>
* 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 <rgm@gnu.org> 2011-05-13 Glenn Morris <rgm@gnu.org>
   
* message.el (message-send-mail-with-sendmail): Assume sendmail-program * message.el (message-send-mail-with-sendmail): Assume sendmail-program
......
...@@ -244,6 +244,8 @@ the Bit Bucket." ...@@ -244,6 +244,8 @@ the Bit Bucket."
(oset db :max-hard (oset db :max-hard
(or gnus-registry-max-entries (or gnus-registry-max-entries
most-positive-fixnum)) most-positive-fixnum))
(oset db :prune-factor
0.1)
(oset db :max-soft (oset db :max-soft
(or gnus-registry-max-pruned-entries (or gnus-registry-max-pruned-entries
most-positive-fixnum)) most-positive-fixnum))
......
...@@ -116,6 +116,12 @@ ...@@ -116,6 +116,12 @@
:type integer :type integer
:custom integer :custom integer
:documentation "Prune as much as possible to get to this size.") :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 (tracked :initarg :tracked
:initform nil :initform nil
:type t :type t
...@@ -357,11 +363,12 @@ Proposes only entries without the :precious keys." ...@@ -357,11 +363,12 @@ Proposes only entries without the :precious keys."
(defmethod registry-prune-hard-candidates ((db registry-db)) (defmethod registry-prune-hard-candidates ((db registry-db))
"Collects pruning candidates from the registry-db object THIS. "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)) (let* ((data (oref db :data))
;; prune to 10 below the max-hard limit so we're not ;; prune to (size * prune-factor) below the max-hard limit so
;; pruning all the time ;; we're not pruning all the time
(limit (- (oref db :max-hard) 10)) (limit (max 0 (- (oref db :max-hard)
(* (registry-size db) (oref db :prune-factor)))))
(candidates (loop for k being the hash-keys of data (candidates (loop for k being the hash-keys of data
collect k))) collect k)))
(list limit candidates)))) (list limit candidates))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment