perf(rss): defer db compaction
Compacting elfeed's DB when killing the search buffer can incur a long delay (which blocks Emacs). Doing so isn't really critical, so I've moved it to kill-emacs-hook instead. Close: #7127 Co-authored-by: merrickluo <merrickluo@users.noreply.github.com>
This commit is contained in:
parent
adb125f41f
commit
f1f010ff99
1 changed files with 8 additions and 4 deletions
|
@ -81,14 +81,18 @@
|
|||
(setq-local shr-width 85)
|
||||
(set-buffer-modified-p nil)))
|
||||
|
||||
(defun +rss--cleanup-on-kill-h ()
|
||||
"Run `elfeed-db-compact'. See `+rss-cleanup-h'."
|
||||
;; `delete-file-projectile-remove-from-cache' slows down `elfeed-db-compact'
|
||||
;; tremendously, so we disable the projectile cache:
|
||||
(let (projectile-enable-caching)
|
||||
(elfeed-db-compact)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +rss-cleanup-h ()
|
||||
"Clean up after an elfeed session. Kills all elfeed and elfeed-org files."
|
||||
(interactive)
|
||||
;; `delete-file-projectile-remove-from-cache' slows down `elfeed-db-compact'
|
||||
;; tremendously, so we disable the projectile cache:
|
||||
(let (projectile-enable-caching)
|
||||
(elfeed-db-compact))
|
||||
(add-hook 'kill-emacs-hook #'+rss--cleanup-on-kill-h)
|
||||
(let ((buf (previous-buffer)))
|
||||
(when (or (null buf) (not (doom-real-buffer-p buf)))
|
||||
(switch-to-buffer (doom-fallback-buffer))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue