Make doom-get-outdated-packages asynchronous

This commit is contained in:
Henrik Lissner 2017-06-21 16:09:58 +02:00
parent 8f7e138357
commit ee1fb43b93
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 35 additions and 5 deletions

View file

@ -57,7 +57,6 @@
+ =feature/jump= Automatic etags generation (for dwim go-to-definition and, perhaps, code-completion for some languages; lua maybe?). + =feature/jump= Automatic etags generation (for dwim go-to-definition and, perhaps, code-completion for some languages; lua maybe?).
+ =lang/php= Automatic and async tags generation using [[https://github.com/xcwen/phpctags][phpctags]]. + =lang/php= Automatic and async tags generation using [[https://github.com/xcwen/phpctags][phpctags]].
+ =lang/lua= True, dynamic code-completion? Looks like [[https://github.com/immerrr/lua-mode/pull/119][this PR in lua-mode]] may have the answer. Does it make ~company-lua~ redundant? + =lang/lua= True, dynamic code-completion? Looks like [[https://github.com/immerrr/lua-mode/pull/119][this PR in lua-mode]] may have the answer. Does it make ~company-lua~ redundant?
+ Make QUELPA outdated-detection async with ~async-start~ and ~async-get~ (in ~doom/packages-update~).
+ =tools/upload= Add ~+upload/open-remote-file~ command to open current file on the remote (with TRAMP). + =tools/upload= Add ~+upload/open-remote-file~ command to open current file on the remote (with TRAMP).
+ Add =bin/org-alert= script -- a cron script that scans TODOs in org files and dispatches system alerts. + Add =bin/org-alert= script -- a cron script that scans TODOs in org files and dispatches system alerts.
+ =feature/workspaces= Add a bookmarks feature, but for wconfs, that can revive file buffers. Also needs an interface. + =feature/workspaces= Add a bookmarks feature, but for wconfs, that can revive file buffers. Also needs an interface.
@ -159,6 +158,7 @@
+ Make ~doom-update-package~ atomic in case of failure. + Make ~doom-update-package~ atomic in case of failure.
+ Make ~doom-refresh-packages~ async. + Make ~doom-refresh-packages~ async.
+ Improve the security of package management (via ELPA) by a) forcing Emacs to verify TLS connections and b) use HTTPS sources for MELPA and ELPA. + Improve the security of package management (via ELPA) by a) forcing Emacs to verify TLS connections and b) use HTTPS sources for MELPA and ELPA.
+ Make ~doom-get-outdated-packages~ asynchronous, producing a substantial speed-up when updating packages from Quelpa sources.
+ =feature= + =feature=
+ =feature/evil= + =feature/evil=
+ Add ~+evil:mc~ command [[https://github.com/gabesoft/evil-mc][evil-mc]]. + Add ~+evil:mc~ command [[https://github.com/gabesoft/evil-mc][evil-mc]].

View file

@ -123,11 +123,41 @@ containing (PACKAGE-SYMBOL OLD-VERSION-LIST NEW-VERSION-LIST).
If INCLUDE-FROZEN-P is non-nil, check frozen packages as well. If INCLUDE-FROZEN-P is non-nil, check frozen packages as well.
Used by `doom/packages-update'." Used by `doom/packages-update'."
(cl-loop for pkg in (doom-get-packages) (let (quelpa-pkgs elpa-pkgs)
if (or (and (doom-package-prop (car pkg) :freeze) (dolist (pkg (doom-get-packages))
(let ((sym (car pkg)))
(when (and (or (not (doom-package-prop sym :freeze))
include-frozen-p) include-frozen-p)
(doom-package-outdated-p (car pkg))) (not (doom-package-prop sym :ignore)))
collect it)) (push sym
(if (eq (doom-package-backend sym) 'quelpa)
quelpa-pkgs
elpa-pkgs)))))
(let* ((max-threads 3) ; TODO Do real CPU core/thread count
(min-per-part 2)
(per-part (max min-per-part (ceiling (/ (length quelpa-pkgs) (float max-threads)))))
(leftover (mod (length quelpa-pkgs) per-part))
(packages '(t))
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
`(lambda ()
(let ((noninteractive t))
(load ,(expand-file-name "core.el" doom-core-dir)))
(delq nil (mapcar #'doom-package-outdated-p ',part))))
futures))
(apply #'append
(delq nil (mapcar #'doom-package-outdated-p elpa-pkgs))
(mapcar #'async-get futures)))))
;;;###autoload ;;;###autoload
(defun doom-get-orphaned-packages () (defun doom-get-orphaned-packages ()