mirror of
https://github.com/org-roam/org-roam
synced 2025-08-27 14:23:32 -05:00
(bugfix): Check future status to prevent multiple async tasks (#160)
Prevents that the `org-roam--build-cache-async` process is blocked forever if an async error occurs. Refs #149, #151
This commit is contained in:
10
org-roam.el
10
org-roam.el
@@ -382,8 +382,9 @@ If PREFIX, downcase the title before insertion."
|
||||
(defun org-roam--build-cache-async ()
|
||||
"Builds the caches asychronously."
|
||||
(interactive)
|
||||
(unless org-roam--ongoing-async-build
|
||||
(setq org-roam--ongoing-async-build t)
|
||||
(unless (and (processp org-roam--ongoing-async-build)
|
||||
(not (async-ready org-roam--ongoing-async-build)))
|
||||
(setq org-roam--ongoing-async-build
|
||||
(async-start
|
||||
`(lambda ()
|
||||
(setq load-path ',load-path)
|
||||
@@ -398,10 +399,9 @@ If PREFIX, downcase the title before insertion."
|
||||
org-roam-forward-links-cache (plist-get cache :forward)
|
||||
org-roam-backward-links-cache (plist-get cache :backward)
|
||||
org-roam-titles-cache (plist-get cache :titles)
|
||||
org-roam-cache-initialized t
|
||||
org-roam--ongoing-async-build nil)) ;; Remove lock
|
||||
org-roam-cache-initialized t)
|
||||
(unless org-roam-mute-cache-build
|
||||
(message "Org-roam cache built!"))))))
|
||||
(message "Org-roam cache built!"))))))))
|
||||
|
||||
(defun org-roam--clear-cache ()
|
||||
"Clears all entries in the caches."
|
||||
|
Reference in New Issue
Block a user