Skip to content
New issue

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

feat: scheduler download tiny file with range header #1024

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

gaius-qi
Copy link
Member

Signed-off-by: Gaius [email protected]

Description

  • Scheduler download tiny file with range header and handle http error code.

Related Issue

Motivation and Context

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist:

  • Code compiles correctly.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@gaius-qi gaius-qi requested a review from a team as a code owner January 21, 2022 08:04
@gaius-qi gaius-qi self-assigned this Jan 21, 2022
@gaius-qi gaius-qi added this to the v2.0.2 milestone Jan 21, 2022
@@ -402,12 +402,17 @@ func (p *Peer) DownloadTinyFile(ctx context.Context) ([]byte, error) {
if err != nil {
return []byte{}, err
}
req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", 0, p.Task.ContentLength.Load()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use headers.Range

@codecov-commenter
Copy link

codecov-commenter commented Jan 21, 2022

Codecov Report

Merging #1024 (30a7b57) into main (037b77d) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1024      +/-   ##
==========================================
- Coverage   45.96%   45.95%   -0.01%     
==========================================
  Files         128      128              
  Lines        9134     9142       +8     
==========================================
+ Hits         4198     4201       +3     
- Misses       4463     4468       +5     
  Partials      473      473              
Flag Coverage Δ
Object-compatibility-e2etests ?
e2etests ?
unittests 45.95% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
scheduler/resource/peer.go 74.84% <100.00%> (+0.48%) ⬆️
client/daemon/transport/transport.go 57.98% <0.00%> (-1.50%) ⬇️
client/daemon/peer/peertask_conductor.go 57.28% <0.00%> (-0.06%) ⬇️
client/daemon/proxy/proxy.go 9.74% <0.00%> (-0.04%) ⬇️
client/daemon/peer/peertask_manager.go 44.30% <0.00%> (+0.14%) ⬆️

@gaius-qi gaius-qi force-pushed the feature/scheduler-download-tiny-file-with-range branch from 9ee832d to 30a7b57 Compare January 21, 2022 08:09
@gaius-qi gaius-qi merged commit 6cba36d into main Jan 21, 2022
@gaius-qi gaius-qi deleted the feature/scheduler-download-tiny-file-with-range branch January 21, 2022 08:57
gaius-qi added a commit that referenced this pull request Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants