From b635427f91964817509f2753f6509bae07c22579 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 10 Jun 2024 15:13:19 +0200 Subject: [PATCH] :bug: Fix incorrect order of update-index operations --- frontend/src/app/main/data/persistence.cljs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/data/persistence.cljs b/frontend/src/app/main/data/persistence.cljs index 8fbcc372ad..4523401762 100644 --- a/frontend/src/app/main/data/persistence.cljs +++ b/frontend/src/app/main/data/persistence.cljs @@ -205,15 +205,21 @@ (update-status :pending))) (rx/take-until stoper-s)) + (->> commits-s + (rx/buffer-time 200) + (rx/mapcat merge-commit) + (rx/map dch/update-indexes) + (rx/take-until stoper-s) + (rx/finalize (fn [] + (log/debug :hint "finalize persistence: changes watcher [index]")))) + ;; Here we watch for local commits, buffer them in a small ;; chunks (very near in time commits) and append them to the ;; persistence queue (->> commits-s (rx/buffer-until notifier-s) (rx/mapcat merge-commit) - (rx/mapcat (fn [commit] - (rx/of (append-commit commit) - (dch/update-indexes commit)))) + (rx/map append-commit) (rx/take-until (rx/delay 100 stoper-s)) (rx/finalize (fn [] (log/debug :hint "finalize persistence: changes watcher"))))