mirror of
https://github.com/remotely-save/remotely-save.git
synced 2024-06-07 21:10:45 +00:00
fix process counting
This commit is contained in:
parent
55175a6d06
commit
8d5868b8d8
@ -9,9 +9,9 @@
|
|||||||
"syncrun_syncingribbon": "{{pluginName}}: syncing from {{triggerSource}}",
|
"syncrun_syncingribbon": "{{pluginName}}: syncing from {{triggerSource}}",
|
||||||
"syncrun_step0": "0/8 Remotely Save is running in dry mode, thus not actual file changes would happen.",
|
"syncrun_step0": "0/8 Remotely Save is running in dry mode, thus not actual file changes would happen.",
|
||||||
"syncrun_step1": "1/8 Remotely Save is preparing ({{serviceType}})",
|
"syncrun_step1": "1/8 Remotely Save is preparing ({{serviceType}})",
|
||||||
"syncrun_step2": "2/8 Starting to fetch remote meta data.",
|
"syncrun_step2": "2/8 Starting to fetch remote meta data and check password.",
|
||||||
"syncrun_step3": "3/8 Checking password correct or not.",
|
|
||||||
"syncrun_passworderr": "Something goes wrong while checking password.",
|
"syncrun_passworderr": "Something goes wrong while checking password.",
|
||||||
|
"syncrun_step3": "3/8 Startting to process remote data.",
|
||||||
"syncrun_step4": "4/8 Starting to fetch local meta data.",
|
"syncrun_step4": "4/8 Starting to fetch local meta data.",
|
||||||
"syncrun_step5": "5/8 Starting to fetch local prev sync data.",
|
"syncrun_step5": "5/8 Starting to fetch local prev sync data.",
|
||||||
"syncrun_step6": "6/8 Starting to generate sync plan.",
|
"syncrun_step6": "6/8 Starting to generate sync plan.",
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
"syncrun_syncingribbon": "{{pluginName}}:正在由 {{triggerSource}} 触发运行",
|
"syncrun_syncingribbon": "{{pluginName}}:正在由 {{triggerSource}} 触发运行",
|
||||||
"syncrun_step0": "0/8 Remotely Save 在空跑(dry run)模式,不会发生实际的文件交换。",
|
"syncrun_step0": "0/8 Remotely Save 在空跑(dry run)模式,不会发生实际的文件交换。",
|
||||||
"syncrun_step1": "1/8 Remotely Save 准备同步({{serviceType}})",
|
"syncrun_step1": "1/8 Remotely Save 准备同步({{serviceType}})",
|
||||||
"syncrun_step2": "2/8 正在获取远端的元数据。",
|
"syncrun_step2": "2/8 正在获取远端的元数据和检查密码。",
|
||||||
"syncrun_step3": "3/8 正在检查密码正确与否。",
|
|
||||||
"syncrun_passworderr": "检查密码时候出错。",
|
"syncrun_passworderr": "检查密码时候出错。",
|
||||||
|
"syncrun_step3": "3/8 正在处理远端的元数据。",
|
||||||
"syncrun_step4": "4/8 正在获取本地的元数据。",
|
"syncrun_step4": "4/8 正在获取本地的元数据。",
|
||||||
"syncrun_step5": "5/8 正在获取本地上一次同步的元数据。",
|
"syncrun_step5": "5/8 正在获取本地上一次同步的元数据。",
|
||||||
"syncrun_step6": "6/8 正在生成同步计划。",
|
"syncrun_step6": "6/8 正在生成同步计划。",
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
"syncrun_syncingribbon": "{{pluginName}}:正在由 {{triggerSource}} 觸發執行",
|
"syncrun_syncingribbon": "{{pluginName}}:正在由 {{triggerSource}} 觸發執行",
|
||||||
"syncrun_step0": "0/8 Remotely Save 在空跑(dry run)模式,不會發生實際的檔案交換。",
|
"syncrun_step0": "0/8 Remotely Save 在空跑(dry run)模式,不會發生實際的檔案交換。",
|
||||||
"syncrun_step1": "1/8 Remotely Save 準備同步({{serviceType}})",
|
"syncrun_step1": "1/8 Remotely Save 準備同步({{serviceType}})",
|
||||||
"syncrun_step2": "2/8 正在獲取遠端的元資料。",
|
"syncrun_step2": "2/8 正在獲取遠端的元數據和檢查密碼。",
|
||||||
"syncrun_step3": "3/8 正在檢查密碼正確與否。",
|
|
||||||
"syncrun_passworderr": "檢查密碼時候出錯。",
|
"syncrun_passworderr": "檢查密碼時候出錯。",
|
||||||
|
"syncrun_step3": "3/8 正在處理遠端的元數據。",
|
||||||
"syncrun_step4": "4/8 正在獲取本地的元資料。",
|
"syncrun_step4": "4/8 正在獲取本地的元資料。",
|
||||||
"syncrun_step5": "5/8 正在獲取本地上一次同步的元資料。",
|
"syncrun_step5": "5/8 正在獲取本地上一次同步的元資料。",
|
||||||
"syncrun_step6": "6/8 正在生成同步計劃。",
|
"syncrun_step6": "6/8 正在生成同步計劃。",
|
||||||
|
63
src/sync.ts
63
src/sync.ts
@ -260,8 +260,8 @@ const ensembleMixedEnties = async (
|
|||||||
|
|
||||||
profiler.insert("ensembleMixedEnties: finish local");
|
profiler.insert("ensembleMixedEnties: finish local");
|
||||||
|
|
||||||
console.debug("in the end of ensembleMixedEnties, finalMappings is:");
|
// console.debug("in the end of ensembleMixedEnties, finalMappings is:");
|
||||||
console.debug(finalMappings);
|
// console.debug(finalMappings);
|
||||||
|
|
||||||
profiler.insert("ensembleMixedEnties: exit");
|
profiler.insert("ensembleMixedEnties: exit");
|
||||||
profiler.removeIndent();
|
profiler.removeIndent();
|
||||||
@ -1285,6 +1285,7 @@ export async function syncer(
|
|||||||
statusBarFunc?: (s: SyncTriggerSourceType, step: number) => any,
|
statusBarFunc?: (s: SyncTriggerSourceType, step: number) => any,
|
||||||
callbackSyncProcess?: any
|
callbackSyncProcess?: any
|
||||||
) {
|
) {
|
||||||
|
console.info(`startting sync.`);
|
||||||
markIsSyncingFunc(true);
|
markIsSyncingFunc(true);
|
||||||
|
|
||||||
let step = 0; // dry mode only
|
let step = 0; // dry mode only
|
||||||
@ -1297,53 +1298,56 @@ export async function syncer(
|
|||||||
profiler.insert("start big sync func");
|
profiler.insert("start big sync func");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
step = 2;
|
||||||
|
await notifyFunc?.(triggerSource, step);
|
||||||
|
await ribboonFunc?.(triggerSource, step);
|
||||||
|
await statusBarFunc?.(triggerSource, step);
|
||||||
if (fsEncrypt.innerFs !== fsRemote) {
|
if (fsEncrypt.innerFs !== fsRemote) {
|
||||||
throw Error(`your enc should has inner of the remote`);
|
throw Error(`your enc should has inner of the remote`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const passwordCheckResult = await fsEncrypt.isPasswordOk();
|
const passwordCheckResult = await fsEncrypt.isPasswordOk();
|
||||||
if (!passwordCheckResult.ok) {
|
if (!passwordCheckResult.ok) {
|
||||||
throw Error(passwordCheckResult.reason);
|
throw Error(passwordCheckResult.reason);
|
||||||
}
|
}
|
||||||
await notifyFunc?.(triggerSource, step);
|
|
||||||
await ribboonFunc?.(triggerSource, step);
|
|
||||||
await statusBarFunc?.(triggerSource, step);
|
|
||||||
profiler.insert(
|
profiler.insert(
|
||||||
`finish step${step} (list partial remote and check password)`
|
`finish step${step} (list partial remote and check password)`
|
||||||
);
|
);
|
||||||
|
|
||||||
step = 2;
|
step = 3;
|
||||||
const remoteEntityList = await fsEncrypt.walk();
|
|
||||||
console.debug(`remoteEntityList:`);
|
|
||||||
console.debug(remoteEntityList);
|
|
||||||
await notifyFunc?.(triggerSource, step);
|
await notifyFunc?.(triggerSource, step);
|
||||||
await ribboonFunc?.(triggerSource, step);
|
await ribboonFunc?.(triggerSource, step);
|
||||||
await statusBarFunc?.(triggerSource, step);
|
await statusBarFunc?.(triggerSource, step);
|
||||||
|
const remoteEntityList = await fsEncrypt.walk();
|
||||||
|
// console.debug(`remoteEntityList:`);
|
||||||
|
// console.debug(remoteEntityList);
|
||||||
profiler.insert(`finish step${step} (list remote)`);
|
profiler.insert(`finish step${step} (list remote)`);
|
||||||
|
|
||||||
step = 3;
|
step = 4;
|
||||||
const localEntityList = await fsLocal.walk();
|
|
||||||
console.debug(`localEntityList:`);
|
|
||||||
console.debug(localEntityList);
|
|
||||||
await notifyFunc?.(triggerSource, step);
|
await notifyFunc?.(triggerSource, step);
|
||||||
await ribboonFunc?.(triggerSource, step);
|
await ribboonFunc?.(triggerSource, step);
|
||||||
await statusBarFunc?.(triggerSource, step);
|
await statusBarFunc?.(triggerSource, step);
|
||||||
|
const localEntityList = await fsLocal.walk();
|
||||||
|
// console.debug(`localEntityList:`);
|
||||||
|
// console.debug(localEntityList);
|
||||||
profiler.insert(`finish step${step} (list local)`);
|
profiler.insert(`finish step${step} (list local)`);
|
||||||
|
|
||||||
step = 4;
|
step = 5;
|
||||||
|
await notifyFunc?.(triggerSource, step);
|
||||||
|
await ribboonFunc?.(triggerSource, step);
|
||||||
|
await statusBarFunc?.(triggerSource, step);
|
||||||
const prevSyncEntityList = await getAllPrevSyncRecordsByVaultAndProfile(
|
const prevSyncEntityList = await getAllPrevSyncRecordsByVaultAndProfile(
|
||||||
db,
|
db,
|
||||||
vaultRandomID,
|
vaultRandomID,
|
||||||
profileID
|
profileID
|
||||||
);
|
);
|
||||||
console.debug(`prevSyncEntityList:`);
|
// console.debug(`prevSyncEntityList:`);
|
||||||
console.debug(prevSyncEntityList);
|
// console.debug(prevSyncEntityList);
|
||||||
|
profiler.insert(`finish step${step} (prev sync)`);
|
||||||
|
|
||||||
|
step = 6;
|
||||||
await notifyFunc?.(triggerSource, step);
|
await notifyFunc?.(triggerSource, step);
|
||||||
await ribboonFunc?.(triggerSource, step);
|
await ribboonFunc?.(triggerSource, step);
|
||||||
await statusBarFunc?.(triggerSource, step);
|
await statusBarFunc?.(triggerSource, step);
|
||||||
profiler.insert(`finish step${step} (prev sync)`);
|
|
||||||
|
|
||||||
step = 5;
|
|
||||||
let mixedEntityMappings = await ensembleMixedEnties(
|
let mixedEntityMappings = await ensembleMixedEnties(
|
||||||
localEntityList,
|
localEntityList,
|
||||||
prevSyncEntityList,
|
prevSyncEntityList,
|
||||||
@ -1356,12 +1360,8 @@ export async function syncer(
|
|||||||
settings.serviceType,
|
settings.serviceType,
|
||||||
profiler
|
profiler
|
||||||
);
|
);
|
||||||
await notifyFunc?.(triggerSource, step);
|
|
||||||
await ribboonFunc?.(triggerSource, step);
|
|
||||||
await statusBarFunc?.(triggerSource, step);
|
|
||||||
profiler.insert(`finish step${step} (build partial mixedEntity)`);
|
profiler.insert(`finish step${step} (build partial mixedEntity)`);
|
||||||
|
|
||||||
step = 6;
|
|
||||||
mixedEntityMappings = await getSyncPlanInplace(
|
mixedEntityMappings = await getSyncPlanInplace(
|
||||||
mixedEntityMappings,
|
mixedEntityMappings,
|
||||||
settings.howToCleanEmptyFolder ?? "clean_both",
|
settings.howToCleanEmptyFolder ?? "clean_both",
|
||||||
@ -1372,9 +1372,6 @@ export async function syncer(
|
|||||||
);
|
);
|
||||||
console.info(`mixedEntityMappings:`);
|
console.info(`mixedEntityMappings:`);
|
||||||
console.info(mixedEntityMappings); // for debugging
|
console.info(mixedEntityMappings); // for debugging
|
||||||
await notifyFunc?.(triggerSource, step);
|
|
||||||
await ribboonFunc?.(triggerSource, step);
|
|
||||||
await statusBarFunc?.(triggerSource, step);
|
|
||||||
profiler.insert("finish building full sync plan");
|
profiler.insert("finish building full sync plan");
|
||||||
|
|
||||||
await insertSyncPlanRecordByVault(
|
await insertSyncPlanRecordByVault(
|
||||||
@ -1383,9 +1380,6 @@ export async function syncer(
|
|||||||
vaultRandomID,
|
vaultRandomID,
|
||||||
settings.serviceType
|
settings.serviceType
|
||||||
);
|
);
|
||||||
await notifyFunc?.(triggerSource, step);
|
|
||||||
await ribboonFunc?.(triggerSource, step);
|
|
||||||
await statusBarFunc?.(triggerSource, step);
|
|
||||||
profiler.insert("finish writing sync plan");
|
profiler.insert("finish writing sync plan");
|
||||||
profiler.insert(`finish step${step} (make plan)`);
|
profiler.insert(`finish step${step} (make plan)`);
|
||||||
|
|
||||||
@ -1394,6 +1388,9 @@ export async function syncer(
|
|||||||
|
|
||||||
step = 7;
|
step = 7;
|
||||||
if (triggerSource !== "dry") {
|
if (triggerSource !== "dry") {
|
||||||
|
await notifyFunc?.(triggerSource, step);
|
||||||
|
await ribboonFunc?.(triggerSource, step);
|
||||||
|
await statusBarFunc?.(triggerSource, step);
|
||||||
await doActualSync(
|
await doActualSync(
|
||||||
mixedEntityMappings,
|
mixedEntityMappings,
|
||||||
fsLocal,
|
fsLocal,
|
||||||
@ -1407,9 +1404,6 @@ export async function syncer(
|
|||||||
profiler,
|
profiler,
|
||||||
callbackSyncProcess
|
callbackSyncProcess
|
||||||
);
|
);
|
||||||
await notifyFunc?.(triggerSource, step);
|
|
||||||
await ribboonFunc?.(triggerSource, step);
|
|
||||||
await statusBarFunc?.(triggerSource, step);
|
|
||||||
profiler.insert(`finish step${step} (actual sync)`);
|
profiler.insert(`finish step${step} (actual sync)`);
|
||||||
} else {
|
} else {
|
||||||
await notifyFunc?.(triggerSource, step);
|
await notifyFunc?.(triggerSource, step);
|
||||||
@ -1428,7 +1422,7 @@ export async function syncer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
profiler.insert("finish syncRun");
|
profiler.insert("finish syncRun");
|
||||||
console.debug(profiler.toString());
|
// console.debug(profiler.toString());
|
||||||
await profiler.save(db, vaultRandomID, settings.serviceType);
|
await profiler.save(db, vaultRandomID, settings.serviceType);
|
||||||
|
|
||||||
step = 8;
|
step = 8;
|
||||||
@ -1436,5 +1430,6 @@ export async function syncer(
|
|||||||
await ribboonFunc?.(triggerSource, step);
|
await ribboonFunc?.(triggerSource, step);
|
||||||
await statusBarFunc?.(triggerSource, step);
|
await statusBarFunc?.(triggerSource, step);
|
||||||
|
|
||||||
|
console.info(`endding sync.`);
|
||||||
markIsSyncingFunc(false);
|
markIsSyncingFunc(false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user