increase per-length for db restore

This commit is contained in:
Tienson Qin
2023-05-23 03:38:51 +08:00
parent b158262ce6
commit a3b3c2e5d4
2 changed files with 16 additions and 16 deletions

View File

@@ -181,9 +181,8 @@
(defn restore-other-data-from-sqlite!
[repo data]
(let [per-length 100]
(let [per-length 2000]
(p/loop [data data]
(prn "count: " (count data))
(cond
(not= repo (state/get-current-repo)) ; switched to another graph
nil
@@ -201,8 +200,7 @@
(remove (fn [data]
(and (map? data)
(= :db/type (:db/ident data))))))]
(prn "part: " part)
(transact! repo part)
(transact! repo part {:restore-db? true})
(p/let [_ (p/delay 200)]
(p/recur (drop per-length data))))))))
@@ -226,13 +224,14 @@
;; (db-migrate/migrate attached-db)
(d/transact! db-conn [(react/kv :db/type "db")
{:schema/version db-schema/version}])
{:schema/version db-schema/version}]
{:restore-db? true})
;; FIXME: transact is too slow
;; Plan: store datoms in sqlite and use d/init-db to initial the db
(util/profile
"transact data"
(d/transact! db-conn blocks'))
(d/transact! db-conn blocks' {:restore-db? true}))
(js/setTimeout
(fn []