optimize folder
This commit is contained in:
parent
832b7e92f9
commit
2d9610cd92
13
src/sync.ts
13
src/sync.ts
@ -540,14 +540,9 @@ const assignOperationToFolderInplace = async (
|
|||||||
// if it was created after deletion, we should keep it as is
|
// if it was created after deletion, we should keep it as is
|
||||||
if (requireApiVersion(API_VER_STAT_FOLDER)) {
|
if (requireApiVersion(API_VER_STAT_FOLDER)) {
|
||||||
if (r.existLocal) {
|
if (r.existLocal) {
|
||||||
try {
|
|
||||||
const { ctime, mtime } = await vault.adapter.stat(r.key);
|
const { ctime, mtime } = await vault.adapter.stat(r.key);
|
||||||
const cmtime = Math.max(ctime, mtime);
|
const cmtime = Math.max(ctime, mtime);
|
||||||
if (
|
if (cmtime > 0 && cmtime >= deltimeLocal && cmtime >= deltimeRemote) {
|
||||||
cmtime > 0 &&
|
|
||||||
cmtime >= deltimeLocal &&
|
|
||||||
cmtime >= deltimeRemote
|
|
||||||
) {
|
|
||||||
keptFolder.add(getParentFolder(r.key));
|
keptFolder.add(getParentFolder(r.key));
|
||||||
if (r.existLocal && r.existRemote) {
|
if (r.existLocal && r.existRemote) {
|
||||||
r.decision = "skipFolder";
|
r.decision = "skipFolder";
|
||||||
@ -561,12 +556,11 @@ const assignOperationToFolderInplace = async (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
// pass
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r.decision === undefined) {
|
||||||
|
// not yet decided by the above reason
|
||||||
if (deltimeLocal > 0 && deltimeLocal > deltimeRemote) {
|
if (deltimeLocal > 0 && deltimeLocal > deltimeRemote) {
|
||||||
r.decision = "uploadLocalDelHistToRemoteFolder";
|
r.decision = "uploadLocalDelHistToRemoteFolder";
|
||||||
r.decisionBranch = 8;
|
r.decisionBranch = 8;
|
||||||
@ -574,6 +568,7 @@ const assignOperationToFolderInplace = async (
|
|||||||
r.decision = "keepRemoteDelHistFolder";
|
r.decision = "keepRemoteDelHistFolder";
|
||||||
r.decisionBranch = 9;
|
r.decisionBranch = 9;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// it does not have any deletion commands
|
// it does not have any deletion commands
|
||||||
// keep it as is, and create it if necessary
|
// keep it as is, and create it if necessary
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user