Fix worker restart.
This commit is contained in:
parent
4bb7d091e4
commit
259f585968
|
@ -159,17 +159,18 @@ const worker = async () => {
|
||||||
upqueue.shift()
|
upqueue.shift()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Note: files may get modified while we're uploading, f is ours
|
|
||||||
const start = f.cloudPos
|
const start = f.cloudPos
|
||||||
const end = Math.min(f.size, start + (1<<20))
|
const end = Math.min(f.size, start + (1<<20))
|
||||||
const control = { name: f.cloudName, size: f.size, start, end }
|
const control = { name: f.cloudName, size: f.size, start, end }
|
||||||
const data = f.slice(start, end)
|
const data = f.slice(start, end)
|
||||||
|
f.cloudPos = end
|
||||||
|
// Note: files may get modified during I/O
|
||||||
ws.sendMsg(control)
|
ws.sendMsg(control)
|
||||||
await ws.sendData(data)
|
await ws.sendData(data)
|
||||||
f.cloudPos = end
|
|
||||||
}
|
}
|
||||||
if (upqueue.length) startWorker()
|
if (upqueue.length) startWorker()
|
||||||
uprogress.status = "idle"
|
uprogress.status = "idle"
|
||||||
|
workerRunning = false
|
||||||
}
|
}
|
||||||
let workerRunning: any = false
|
let workerRunning: any = false
|
||||||
const startWorker = () => {
|
const startWorker = () => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user