branch: elpa/gnosis
commit 73ef662c840bb0c0d30d07644f1e9a3598cc3a7d
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>
dashboard: warm-cache: skip if cache already populated.
---
gnosis-dashboard.el | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/gnosis-dashboard.el b/gnosis-dashboard.el
index 6e7170fbcc..ae5714f302 100644
--- a/gnosis-dashboard.el
+++ b/gnosis-dashboard.el
@@ -518,17 +518,18 @@ Continues as long as the dashboard buffer exists."
(defun gnosis-dashboard-warm-cache ()
"Warm the entry cache for all themata in the background.
Continues as long as the dashboard buffer exists, regardless of
-which view the user navigates to."
- (let* ((all-ids (gnosis-select 'id 'themata nil t))
- (chunks (let (result (rest all-ids))
- (while rest
- (push (seq-take rest gnosis-dashboard-chunk-size) result)
- (setq rest (nthcdr gnosis-dashboard-chunk-size rest)))
- (nreverse result))))
- (when chunks
- (run-with-timer gnosis-dashboard-timer-delay nil
- #'gnosis-dashboard--warm-cache-chunk
- chunks (length all-ids) 0))))
+which view the user navigates to. Skips if cache is already populated."
+ (when (zerop (hash-table-count gnosis-dashboard--entry-cache))
+ (let* ((all-ids (gnosis-select 'id 'themata nil t))
+ (chunks (let (result (rest all-ids))
+ (while rest
+ (push (seq-take rest gnosis-dashboard-chunk-size)
result)
+ (setq rest (nthcdr gnosis-dashboard-chunk-size rest)))
+ (nreverse result))))
+ (when chunks
+ (run-with-timer gnosis-dashboard-timer-delay nil
+ #'gnosis-dashboard--warm-cache-chunk
+ chunks (length all-ids) 0)))))
(defun gnosis-dashboard--start-prerender ()
"Begin background pre-rendering of the all-themata view.