修复在分片下载的协程中,因为关闭文件不及时造成的最后完成rename时提示文件被占用的错误 #60
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
使用断点续传多线程方式下载文件,线上使用后发现,经常会出现rename xxx.zip.temp yyy.zip:the process cannot access the file because it is being used by another process 的错误导致下载失败
temp文件已经下载成功,但是最后重命名Rename的时候会出现这个错误
发现在下载分片的协程中,使用了defer来进行temp文件描述符的关闭,这样可能会造成多分片的情况下,result 管道已经通知,但是temp的fd还未及时关闭,很大概率会导致rename时出现文件被占用