Commit 2815174f authored by Eric Abrahamsen's avatar Eric Abrahamsen

Prevent the Gnus registry from being loaded twice at startup

* lisp/gnus/gnus-registry.el (gnus-registry-load): Check if the
  registry is already loaded, and don't load again unless new optional
  FORCE argument is non-nil.
  (gnus-registry-clear): New function to clear the registry, added as
  a Gnus shutdown. Now that loading doesn't unilaterally reset the
  registry, we need to make sure it is reloaded when Gnus is.
parent 8c56eb05
Pipeline #2122 failed with stage
in 53 minutes
......@@ -307,9 +307,16 @@ This is not required after changing `gnus-registry-cache-file'."
(gnus-message 4 "Remaking the Gnus registry")
(setq gnus-registry-db (gnus-registry-make-db))))
(defun gnus-registry-load ()
"Load the registry from the cache file."
(defun gnus-registry-load (&optional force)
"Load the registry from the cache file.
If the registry is already loaded, don't reload unless FORCE is
(when (or force
;; The registry is loaded by both
;; `gnus-registry-initialize' and the read-newsrc hook.
;; Don't load twice.
(null (eieio-object-p gnus-registry-db)))
(let ((file gnus-registry-cache-file))
(condition-case nil
(gnus-registry-read file)
......@@ -333,7 +340,7 @@ This is not required after changing `gnus-registry-cache-file'."
"The Gnus registry could not be loaded from %s, creating a new one"
(gnus-registry-remake-db t)))))
(gnus-registry-remake-db t))))))
(defun gnus-registry-read (file)
"Do the actual reading of the registry persistence file."
......@@ -1102,6 +1109,12 @@ only the last one's marks are returned."
(gnus-registry-set-id-key id key val))))
(message "Import done, collected %d entries" count))))
(defun gnus-registry-clear ()
"Clear the registry."
(setq gnus-registry-db nil))
(gnus-add-shutdown 'gnus-registry-clear 'gnus)
(defun gnus-registry-initialize ()
"Initialize the Gnus registry."
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