bulk load db and remove some verbose output, to speed up
This commit is contained in:
parent
c5a7085fda
commit
0e6182b887
|
@ -76,6 +76,7 @@
|
|||
"emoji-regex": "^10.3.0",
|
||||
"http-status-codes": "^2.3.0",
|
||||
"localforage": "^1.10.0",
|
||||
"localforage-getitems": "^1.4.2",
|
||||
"lodash": "^4.17.21",
|
||||
"lucide": "^0.298.0",
|
||||
"mime-types": "^2.1.35",
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import localforage from "localforage";
|
||||
import { extendPrototype } from "localforage-getitems";
|
||||
extendPrototype(localforage);
|
||||
export type LocalForage = typeof localforage;
|
||||
import { nanoid } from "nanoid";
|
||||
import { requireApiVersion, TAbstractFile, TFile, TFolder } from "obsidian";
|
||||
|
@ -434,13 +436,12 @@ export const getAllPrevSyncRecordsByVaultAndProfile = async (
|
|||
vaultRandomID: string,
|
||||
profileID: string
|
||||
) => {
|
||||
// console.debug('inside getAllPrevSyncRecordsByVaultAndProfile')
|
||||
const keys = await db.prevSyncRecordsTbl.keys();
|
||||
// console.debug(`inside getAllPrevSyncRecordsByVaultAndProfile, keys=${keys}`)
|
||||
const res: Entity[] = [];
|
||||
for (const key of keys) {
|
||||
const kv: Record<string, Entity | null> =
|
||||
await db.prevSyncRecordsTbl.getItems();
|
||||
for (const key of Object.getOwnPropertyNames(kv)) {
|
||||
if (key.startsWith(`${vaultRandomID}\t${profileID}\t`)) {
|
||||
const val: Entity | null = await db.prevSyncRecordsTbl.getItem(key);
|
||||
const val = kv[key];
|
||||
if (val !== null) {
|
||||
res.push(val);
|
||||
}
|
||||
|
|
14
src/sync.ts
14
src/sync.ts
|
@ -1369,9 +1369,9 @@ export const doActualSync = async (
|
|||
|
||||
for (let j = 0; j < operations.length; ++j) {
|
||||
const singleLevelOps = operations[j];
|
||||
console.debug(
|
||||
`singleLevelOps=${JSON.stringify(singleLevelOps, null, 2)}`
|
||||
);
|
||||
// console.debug(
|
||||
// `singleLevelOps=${JSON.stringify(singleLevelOps, null, 2)}`
|
||||
// );
|
||||
if (singleLevelOps === undefined || singleLevelOps === null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1385,9 +1385,9 @@ export const doActualSync = async (
|
|||
const key = val.key;
|
||||
|
||||
const fn = async () => {
|
||||
console.debug(
|
||||
`start syncing "${key}" with plan ${JSON.stringify(val)}`
|
||||
);
|
||||
// console.debug(
|
||||
// `start syncing "${key}" with plan ${JSON.stringify(val)}`
|
||||
// );
|
||||
|
||||
if (callbackSyncProcess !== undefined) {
|
||||
await callbackSyncProcess(
|
||||
|
@ -1412,7 +1412,7 @@ export const doActualSync = async (
|
|||
cipher
|
||||
);
|
||||
|
||||
console.debug(`finished ${key}`);
|
||||
// console.debug(`finished ${key}`);
|
||||
};
|
||||
|
||||
queue.add(fn).catch((e) => {
|
||||
|
|
Loading…
Reference in New Issue