We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用file.Uploader.Upload()时,我发现只要是几百MB及以上的文件100%失败,SuperFile2Upload返回空回复:
file.Uploader.Upload()
2023/04/07 13:32:14 upload failed, path[...] response[] 2023/04/07 13:32:14 SuperFile2UploadFailed, partseq[4] err[unexpected end of JSON input] 2023/04/07 13:32:14 strconv.Atoi failed, err: strconv.Atoi: parsing "": invalid syntax
把并发数调低之后就没问题了,1-3都行,别的没试:
diff --git a/file/upload.go b/file/upload.go index 575f508..f787946 100644 --- a/file/upload.go +++ b/file/upload.go @@ -119,7 +119,7 @@ func (u *Uploader) Upload() (UploadResponse, error) { } defer file.Close() uploadRespChan := make(chan SuperFile2UploadResponse, sliceNum) - sem := make(chan int, 10) //限制并发数,以防大文件上传导致占用服务器大量内存 + sem := make(chan int, 3) //限制并发数,以防大文件上传导致占用服务器大量内存 for i := 0; i < sliceNum; i++ { buffer := make([]byte, sliceSize) n, err := file.Read(buffer[:])
第一次用百度网盘的API,也不知道是不是常见问题,反正记录一下方便遇到同样问题的朋友。我个人使用其实2并发也能完全占满上传带宽。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
使用
file.Uploader.Upload()
时,我发现只要是几百MB及以上的文件100%失败,SuperFile2Upload返回空回复:把并发数调低之后就没问题了,1-3都行,别的没试:
第一次用百度网盘的API,也不知道是不是常见问题,反正记录一下方便遇到同样问题的朋友。我个人使用其实2并发也能完全占满上传带宽。
The text was updated successfully, but these errors were encountered: