Fix: panics inside of task was not correctly logged into DB

Feat: slave node use new API to upload file to master
This commit is contained in:
HFO4
2022-03-13 16:20:50 +08:00
parent 9136f3caec
commit c89327631e
10 changed files with 54 additions and 30 deletions

View File

@@ -117,16 +117,18 @@ func (job *TransferTask) Do() {
}
// 切换为从机节点处理上传
fs.SetPolicyFromPath(path.Dir(dst))
fs.SwitchToSlaveHandler(node)
err = fs.UploadFromStream(context.Background(), &fsctx.FileStream{
File: nil,
Size: job.TaskProps.SrcSizes[file],
Name: path.Base(dst),
VirtualPath: path.Dir(dst),
})
Src: file,
}, false)
} else {
// 主机节点中转
err = fs.UploadFromPath(context.Background(), file, dst, true, 0)
err = fs.UploadFromPath(context.Background(), file, dst, 0)
}
if err != nil {