fix process counting

This commit is contained in:
fyears 2024-04-27 17:11:48 +08:00
parent 55175a6d06
commit 8d5868b8d8
4 changed files with 35 additions and 40 deletions

View File

@ -9,9 +9,9 @@
"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_step1": "1/8 Remotely Save is preparing ({{serviceType}})",
"syncrun_step2": "2/8 Starting to fetch remote meta data.",
"syncrun_step3": "3/8 Checking password correct or not.",
"syncrun_step2": "2/8 Starting to fetch remote meta data and check 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_step5": "5/8 Starting to fetch local prev sync data.",
"syncrun_step6": "6/8 Starting to generate sync plan.",

View File

@ -9,9 +9,9 @@
"syncrun_syncingribbon": "{{pluginName}}:正在由 {{triggerSource}} 触发运行",
"syncrun_step0": "0/8 Remotely Save 在空跑dry run模式不会发生实际的文件交换。",
"syncrun_step1": "1/8 Remotely Save 准备同步({{serviceType}}",
"syncrun_step2": "2/8 正在获取远端的元数据。",
"syncrun_step3": "3/8 正在检查密码正确与否。",
"syncrun_step2": "2/8 正在获取远端的元数据和检查密码。",
"syncrun_passworderr": "检查密码时候出错。",
"syncrun_step3": "3/8 正在处理远端的元数据。",
"syncrun_step4": "4/8 正在获取本地的元数据。",
"syncrun_step5": "5/8 正在获取本地上一次同步的元数据。",
"syncrun_step6": "6/8 正在生成同步计划。",

View File

@ -9,9 +9,9 @@
"syncrun_syncingribbon": "{{pluginName}}:正在由 {{triggerSource}} 觸發執行",
"syncrun_step0": "0/8 Remotely Save 在空跑dry run模式不會發生實際的檔案交換。",
"syncrun_step1": "1/8 Remotely Save 準備同步({{serviceType}}",
"syncrun_step2": "2/8 正在獲取遠端的元資料。",
"syncrun_step3": "3/8 正在檢查密碼正確與否。",
"syncrun_step2": "2/8 正在獲取遠端的元數據和檢查密碼。",
"syncrun_passworderr": "檢查密碼時候出錯。",
"syncrun_step3": "3/8 正在處理遠端的元數據。",
"syncrun_step4": "4/8 正在獲取本地的元資料。",
"syncrun_step5": "5/8 正在獲取本地上一次同步的元資料。",
"syncrun_step6": "6/8 正在生成同步計劃。",

View File

@ -260,8 +260,8 @@ const ensembleMixedEnties = async (
profiler.insert("ensembleMixedEnties: finish local");
console.debug("in the end of ensembleMixedEnties, finalMappings is:");
console.debug(finalMappings);
// console.debug("in the end of ensembleMixedEnties, finalMappings is:");
// console.debug(finalMappings);
profiler.insert("ensembleMixedEnties: exit");
profiler.removeIndent();
@ -1285,6 +1285,7 @@ export async function syncer(
statusBarFunc?: (s: SyncTriggerSourceType, step: number) => any,
callbackSyncProcess?: any
) {
console.info(`startting sync.`);
markIsSyncingFunc(true);
let step = 0; // dry mode only
@ -1297,53 +1298,56 @@ export async function syncer(
profiler.insert("start big sync func");
try {
step = 2;
await notifyFunc?.(triggerSource, step);
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
if (fsEncrypt.innerFs !== fsRemote) {
throw Error(`your enc should has inner of the remote`);
}
const passwordCheckResult = await fsEncrypt.isPasswordOk();
if (!passwordCheckResult.ok) {
throw Error(passwordCheckResult.reason);
}
await notifyFunc?.(triggerSource, step);
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
profiler.insert(
`finish step${step} (list partial remote and check password)`
);
step = 2;
const remoteEntityList = await fsEncrypt.walk();
console.debug(`remoteEntityList:`);
console.debug(remoteEntityList);
step = 3;
await notifyFunc?.(triggerSource, step);
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
const remoteEntityList = await fsEncrypt.walk();
// console.debug(`remoteEntityList:`);
// console.debug(remoteEntityList);
profiler.insert(`finish step${step} (list remote)`);
step = 3;
const localEntityList = await fsLocal.walk();
console.debug(`localEntityList:`);
console.debug(localEntityList);
step = 4;
await notifyFunc?.(triggerSource, step);
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
const localEntityList = await fsLocal.walk();
// console.debug(`localEntityList:`);
// console.debug(localEntityList);
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(
db,
vaultRandomID,
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 ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
profiler.insert(`finish step${step} (prev sync)`);
step = 5;
let mixedEntityMappings = await ensembleMixedEnties(
localEntityList,
prevSyncEntityList,
@ -1356,12 +1360,8 @@ export async function syncer(
settings.serviceType,
profiler
);
await notifyFunc?.(triggerSource, step);
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
profiler.insert(`finish step${step} (build partial mixedEntity)`);
step = 6;
mixedEntityMappings = await getSyncPlanInplace(
mixedEntityMappings,
settings.howToCleanEmptyFolder ?? "clean_both",
@ -1372,9 +1372,6 @@ export async function syncer(
);
console.info(`mixedEntityMappings:`);
console.info(mixedEntityMappings); // for debugging
await notifyFunc?.(triggerSource, step);
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
profiler.insert("finish building full sync plan");
await insertSyncPlanRecordByVault(
@ -1383,9 +1380,6 @@ export async function syncer(
vaultRandomID,
settings.serviceType
);
await notifyFunc?.(triggerSource, step);
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
profiler.insert("finish writing sync plan");
profiler.insert(`finish step${step} (make plan)`);
@ -1394,6 +1388,9 @@ export async function syncer(
step = 7;
if (triggerSource !== "dry") {
await notifyFunc?.(triggerSource, step);
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
await doActualSync(
mixedEntityMappings,
fsLocal,
@ -1407,9 +1404,6 @@ export async function syncer(
profiler,
callbackSyncProcess
);
await notifyFunc?.(triggerSource, step);
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
profiler.insert(`finish step${step} (actual sync)`);
} else {
await notifyFunc?.(triggerSource, step);
@ -1428,7 +1422,7 @@ export async function syncer(
}
profiler.insert("finish syncRun");
console.debug(profiler.toString());
// console.debug(profiler.toString());
await profiler.save(db, vaultRandomID, settings.serviceType);
step = 8;
@ -1436,5 +1430,6 @@ export async function syncer(
await ribboonFunc?.(triggerSource, step);
await statusBarFunc?.(triggerSource, step);
console.info(`endding sync.`);
markIsSyncingFunc(false);
}