|
8 | 8 | [frontend.common.thread-api :as thread-api]
|
9 | 9 | [frontend.worker-common.util :as worker-util]
|
10 | 10 | [frontend.worker.crypt :as crypt]
|
11 |
| - [frontend.worker.db-listener :as db-listener] |
12 | 11 | [frontend.worker.db-metadata :as worker-db-metadata]
|
13 | 12 | [frontend.worker.rtc.client-op :as client-op]
|
14 | 13 | [frontend.worker.rtc.const :as rtc-const]
|
|
20 | 19 | [lambdaisland.glogi :as log]
|
21 | 20 | [logseq.db :as ldb]
|
22 | 21 | [logseq.db.frontend.malli-schema :as db-malli-schema]
|
23 |
| - [logseq.db.frontend.schema :as db-schema] |
24 |
| - [logseq.db.sqlite.create-graph :as sqlite-create-graph] |
25 | 22 | [logseq.db.sqlite.util :as sqlite-util]
|
26 | 23 | [logseq.outliner.pipeline :as outliner-pipeline]
|
27 | 24 | [malli.core :as ma]
|
|
161 | 158 | (client-op/remove-local-tx repo)
|
162 | 159 | (client-op/add-all-exists-asset-as-ops repo)
|
163 | 160 | (crypt/store-graph-keys-jwk repo aes-key-jwk)
|
164 |
| - (when-not rtc-const/RTC-E2E-TEST |
165 |
| - (c.m/<? (worker-db-metadata/<store repo (pr-str {:kv/value graph-uuid})))) |
| 161 | + (c.m/<? (worker-db-metadata/<store repo (pr-str {:kv/value graph-uuid}))) |
166 | 162 | (rtc-log-and-state/rtc-log :rtc.log/upload {:sub-type :upload-completed
|
167 | 163 | :message "upload-graph completed"})
|
168 | 164 | {:graph-uuid graph-uuid})
|
|
269 | 265 | [schema-blocks (conj normal-blocks block)]))
|
270 | 266 | [[] []] blocks))
|
271 | 267 |
|
272 |
| -(defn- create-graph-for-rtc-test |
273 |
| - "TODO: remove this fn |
274 |
| - it's complex to setup db-worker related stuff, when I only want to test rtc related logic" |
275 |
| - [repo init-tx-data other-tx-data] |
276 |
| - (let [conn (d/create-conn db-schema/schema) |
277 |
| - db-initial-data (sqlite-create-graph/build-db-initial-data "")] |
278 |
| - (swap! worker-state/*datascript-conns assoc repo conn) |
279 |
| - (d/transact! conn db-initial-data {:initial-db? true |
280 |
| - :frontend.worker.pipeline/skip-store-conn rtc-const/RTC-E2E-TEST}) |
281 |
| - (db-listener/listen-db-changes! repo conn) |
282 |
| - (d/transact! conn init-tx-data {:rtc-download-graph? true |
283 |
| - :gen-undo-ops? false |
284 |
| - ;; only transact db schema, skip validation to avoid warning |
285 |
| - :frontend.worker.pipeline/skip-validate-db? true |
286 |
| - :frontend.worker.pipeline/skip-store-conn rtc-const/RTC-E2E-TEST |
287 |
| - :persist-op? false}) |
288 |
| - (d/transact! conn other-tx-data {:rtc-download-graph? true |
289 |
| - :gen-undo-ops? false |
290 |
| - :frontend.worker.pipeline/skip-store-conn rtc-const/RTC-E2E-TEST |
291 |
| - :persist-op? false}) |
292 |
| - (transact-remote-schema-version! repo) |
293 |
| - (<transact-block-refs! repo nil))) |
294 |
| - |
295 | 268 | (defn- blocks-resolve-temp-id
|
296 | 269 | [schema-blocks blocks]
|
297 | 270 | (let [uuids (map :block/uuid blocks)
|
|
388 | 361 | (client-op/update-local-tx repo remote-t)
|
389 | 362 | (rtc-log-and-state/update-local-t graph-uuid remote-t)
|
390 | 363 | (rtc-log-and-state/update-remote-t graph-uuid remote-t)
|
391 |
| - (if rtc-const/RTC-E2E-TEST |
392 |
| - (create-graph-for-rtc-test repo init-tx-data tx-data) |
393 |
| - (c.m/<? |
394 |
| - (p/do! |
395 |
| - ((@thread-api/*thread-apis :thread-api/create-or-open-db) repo {:close-other-db? false}) |
396 |
| - ((@thread-api/*thread-apis :thread-api/export-db) repo) |
397 |
| - (rtc-log-and-state/rtc-log :rtc.log/download {:sub-type :transact-graph-data-to-db-1 |
398 |
| - :message (str "transacting init data(" (count init-tx-data) ")") |
399 |
| - :graph-uuid graph-uuid}) |
400 |
| - ((@thread-api/*thread-apis :thread-api/transact) |
401 |
| - repo init-tx-data |
402 |
| - {:rtc-download-graph? true |
403 |
| - :gen-undo-ops? false |
| 364 | + (c.m/<? |
| 365 | + (p/do! |
| 366 | + ((@thread-api/*thread-apis :thread-api/create-or-open-db) repo {:close-other-db? false}) |
| 367 | + ((@thread-api/*thread-apis :thread-api/export-db) repo) |
| 368 | + (rtc-log-and-state/rtc-log :rtc.log/download {:sub-type :transact-graph-data-to-db-1 |
| 369 | + :message (str "transacting init data(" (count init-tx-data) ")") |
| 370 | + :graph-uuid graph-uuid}) |
| 371 | + ((@thread-api/*thread-apis :thread-api/transact) |
| 372 | + repo init-tx-data |
| 373 | + {:rtc-download-graph? true |
| 374 | + :gen-undo-ops? false |
404 | 375 | ;; only transact db schema, skip validation to avoid warning
|
405 |
| - :frontend.worker.pipeline/skip-validate-db? true |
406 |
| - :persist-op? false} |
407 |
| - (worker-state/get-context)) |
408 |
| - (rtc-log-and-state/rtc-log :rtc.log/download {:sub-type :transact-graph-data-to-db-2 |
409 |
| - :message (str "transacting other data(" (count tx-data) ")") |
410 |
| - :graph-uuid graph-uuid}) |
411 |
| - (p/doseq [tx-data* (partition-all 500 tx-data)] |
412 |
| - ((@thread-api/*thread-apis :thread-api/transact) |
413 |
| - repo tx-data* {:rtc-download-graph? true |
414 |
| - :gen-undo-ops? false |
415 |
| - :persist-op? false} (worker-state/get-context)) |
416 |
| - (p/delay 10)) |
417 |
| - (rtc-log-and-state/rtc-log :rtc.log/download {:sub-type :transact-graph-data-to-db-3 |
418 |
| - :message "transacting remote schema version" |
419 |
| - :graph-uuid graph-uuid}) |
420 |
| - (transact-remote-schema-version! repo) |
421 |
| - (<transact-block-refs! repo graph-uuid)))) |
| 376 | + :frontend.worker.pipeline/skip-validate-db? true |
| 377 | + :persist-op? false} |
| 378 | + (worker-state/get-context)) |
| 379 | + (rtc-log-and-state/rtc-log :rtc.log/download {:sub-type :transact-graph-data-to-db-2 |
| 380 | + :message (str "transacting other data(" (count tx-data) ")") |
| 381 | + :graph-uuid graph-uuid}) |
| 382 | + (p/doseq [tx-data* (partition-all 500 tx-data)] |
| 383 | + ((@thread-api/*thread-apis :thread-api/transact) |
| 384 | + repo tx-data* {:rtc-download-graph? true |
| 385 | + :gen-undo-ops? false |
| 386 | + :persist-op? false} (worker-state/get-context)) |
| 387 | + (p/delay 10)) |
| 388 | + (rtc-log-and-state/rtc-log :rtc.log/download {:sub-type :transact-graph-data-to-db-3 |
| 389 | + :message "transacting remote schema version" |
| 390 | + :graph-uuid graph-uuid}) |
| 391 | + (transact-remote-schema-version! repo) |
| 392 | + (<transact-block-refs! repo graph-uuid))) |
422 | 393 | (shared-service/broadcast-to-clients! :add-repo {:repo repo}))))
|
423 | 394 |
|
424 | 395 | ;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
490 | 461 | :message "transacted all blocks"
|
491 | 462 | :graph-uuid graph-uuid})
|
492 | 463 | (client-op/update-graph-uuid repo graph-uuid)
|
493 |
| - (when-not rtc-const/RTC-E2E-TEST |
494 |
| - (c.m/<? (worker-db-metadata/<store repo (pr-str {:kv/value graph-uuid})))) |
| 464 | + (c.m/<? (worker-db-metadata/<store repo (pr-str {:kv/value graph-uuid}))) |
495 | 465 | (worker-state/set-rtc-downloading-graph! false)
|
496 | 466 | (rtc-log-and-state/rtc-log :rtc.log/download {:sub-type :download-completed
|
497 | 467 | :message "download completed"
|
|
600 | 570 | datoms)))]
|
601 | 571 | (prn ::count (count refs-tx))
|
602 | 572 | ;; (prn ::take-20 (take 20 (sort-by second > (into [] (frequencies (map last refs-tx))))))
|
603 |
| - ) |
604 |
| - |
605 |
| - |
606 |
| - ) |
| 573 | + )) |
0 commit comments