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

@@ -26,6 +26,7 @@ type UploadTaskInfo struct {
UploadSessionID *string
AppendStart uint64
Model interface{}
Src string
}
// FileHeader 上传来的文件数据处理器
@@ -54,14 +55,23 @@ type FileStream struct {
UploadSessionID *string
AppendStart uint64
Model interface{}
Src string
}
func (file *FileStream) Read(p []byte) (n int, err error) {
return file.File.Read(p)
if file.File != nil {
return file.File.Read(p)
}
return 0, io.EOF
}
func (file *FileStream) Close() error {
return file.File.Close()
if file.File != nil {
return file.File.Close()
}
return nil
}
func (file *FileStream) Seek(offset int64, whence int) (int64, error) {
@@ -85,6 +95,7 @@ func (file *FileStream) Info() *UploadTaskInfo {
UploadSessionID: file.UploadSessionID,
AppendStart: file.AppendStart,
Model: file.Model,
Src: file.Src,
}
}