enhance: save db to disk periodically

The interval is set to 10 minutes now.
New backup will be written if its size is not equal to the latest
backup one's.
This commit is contained in:
Tienson Qin
2023-12-13 02:03:49 +08:00
parent 436ff54039
commit ac780a1aa4
5 changed files with 38 additions and 14 deletions

View File

@@ -49,7 +49,8 @@
[cljs-bean.core :as bean]
[frontend.handler.test :as test]
[frontend.db.rtc.op-mem-layer :as op-mem-layer]
[frontend.persist-db.browser :as db-browser]))
[frontend.persist-db.browser :as db-browser]
[frontend.persist-db :as persist-db]))
(defn- set-global-error-notification!
[]
@@ -246,6 +247,7 @@
_ (mobile-util/hide-splash) ;; hide splash as early as ui is stable
repo (or (state/get-current-repo) (:url (first repos)))
_ (restore-and-setup! repo repos)]
(persist-db/run-periodically-export!)
(when (mobile-util/native-platform?)
(state/restore-mobile-theme!)))
(p/catch (fn [e]