simplify merge file
This commit is contained in:
parent
be5518e320
commit
6ed04a651b
@ -1,4 +1,3 @@
|
|||||||
import cloneDeep from "lodash/cloneDeep";
|
|
||||||
import isEqual from "lodash/isEqual";
|
import isEqual from "lodash/isEqual";
|
||||||
// import {
|
// import {
|
||||||
// makePatches,
|
// makePatches,
|
||||||
@ -145,20 +144,7 @@ export async function mergeFile(
|
|||||||
// left (local) must wait for the right
|
// left (local) must wait for the right
|
||||||
// because the mtime might be different after upload
|
// because the mtime might be different after upload
|
||||||
// upload firstly
|
// upload firstly
|
||||||
// hack:
|
const rightEntity = await right.writeFile(key, newArrayBuffer, mtime, mtime);
|
||||||
// writing to remote with encryption will move the arraybuffer to worker
|
|
||||||
// so the newArrayBuffer is not usable later
|
|
||||||
// we have to copy here
|
|
||||||
// because mergable files should not be too large
|
|
||||||
// so the performance should not be too bad
|
|
||||||
// TODO: optimize for non-encryption mode?
|
|
||||||
const newArrayBufferCopied = cloneDeep(newArrayBuffer);
|
|
||||||
const rightEntity = await right.writeFile(
|
|
||||||
key,
|
|
||||||
newArrayBufferCopied,
|
|
||||||
mtime,
|
|
||||||
mtime
|
|
||||||
);
|
|
||||||
// write local secondly
|
// write local secondly
|
||||||
const leftEntity = await left.writeFile(
|
const leftEntity = await left.writeFile(
|
||||||
key,
|
key,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user