Simplify doom-get-outdated-packages (1 thread per quelpa pkg)
This commit is contained in:
parent
b99f90e969
commit
43a9acec28
1 changed files with 8 additions and 21 deletions
|
@ -134,33 +134,20 @@ Used by `doom/packages-update'."
|
||||||
(if (eq (doom-package-backend sym) 'quelpa)
|
(if (eq (doom-package-backend sym) 'quelpa)
|
||||||
quelpa-pkgs
|
quelpa-pkgs
|
||||||
elpa-pkgs)))))
|
elpa-pkgs)))))
|
||||||
;; The bottleneck in this process is quelpa's version checks, so partition
|
;; The bottleneck in this process is quelpa's version checks, so check them
|
||||||
;; and check them asynchronously.
|
;; asynchronously.
|
||||||
(let* ((max-threads 3) ; TODO Do real CPU core/thread count
|
(let (futures)
|
||||||
(min-per-part 2)
|
(dolist (pkg quelpa-pkgs)
|
||||||
(per-part (max min-per-part (ceiling (/ (length quelpa-pkgs) (float max-threads)))))
|
(debug! "New thread for: %s" pkg)
|
||||||
(leftover (mod (length quelpa-pkgs) per-part))
|
|
||||||
parts
|
|
||||||
futures)
|
|
||||||
(while quelpa-pkgs
|
|
||||||
(let (part)
|
|
||||||
(dotimes (_i (+ per-part leftover))
|
|
||||||
(when-let (p (pop quelpa-pkgs))
|
|
||||||
(push p part)))
|
|
||||||
(setq leftover 0)
|
|
||||||
(push (nreverse part) parts)))
|
|
||||||
(dolist (part (reverse parts))
|
|
||||||
(debug! "New thread for: %s" part)
|
|
||||||
(push (async-start
|
(push (async-start
|
||||||
`(lambda ()
|
`(lambda ()
|
||||||
(setq user-emacs-directory ,user-emacs-directory)
|
(setq user-emacs-directory ,user-emacs-directory)
|
||||||
(let ((noninteractive t))
|
(let ((noninteractive t))
|
||||||
(load ,(expand-file-name "core.el" doom-core-dir)))
|
(load ,(expand-file-name "core.el" doom-core-dir)))
|
||||||
(delq nil (mapcar #'doom-package-outdated-p ',part))))
|
(doom-package-outdated-p ',pkg)))
|
||||||
futures))
|
futures))
|
||||||
(apply #'append
|
(append (delq nil (mapcar #'doom-package-outdated-p elpa-pkgs))
|
||||||
(delq nil (mapcar #'doom-package-outdated-p elpa-pkgs))
|
(delq nil (mapcar #'async-get (reverse futures)))))))
|
||||||
(mapcar #'async-get futures)))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-get-orphaned-packages ()
|
(defun doom-get-orphaned-packages ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue