-
Notifications
You must be signed in to change notification settings - Fork 6
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
fixed chunk size #173
Merged
Merged
fixed chunk size #173
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
99c28d5
WIP: fixed chunk size
philandstuff 9862405
Move constants in downloads to common.go
tempusfrangit 6f9c682
Wire up --chunk-size to cli options
tempusfrangit d700109
Cleanup Linting
tempusfrangit efe1ac0
Update Buffer to use ChunkSize
tempusfrangit 31bc26d
Failing test case
philandstuff 7ec1a9b
Fix buffermode
philandstuff 870dcd8
Update pkg/download/options.go
philandstuff 6517274
Update README.md
philandstuff 401e975
Update README.md
philandstuff fae7259
continue to respect minchunksize
philandstuff e71b6b2
Cleanup Aliasing
tempusfrangit a41a4c4
more aliasing cleanup
philandstuff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package download | ||
|
||
import ( | ||
"github.com/dustin/go-humanize" | ||
"regexp" | ||
|
||
"github.com/dustin/go-humanize" | ||
) | ||
|
||
const defaultMinChunkSize = 16 * humanize.MiByte | ||
const defaultChunkSize = 125 * humanize.MiByte | ||
|
||
var contentRangeRegexp = regexp.MustCompile(`^bytes .*/([0-9]+)$`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should still check MinimumChunkSize and adjust ChunkSize upwards to satisfy it if it's set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear why we are bothering to keep min chunk size. It seems... odd? Let's just specify the chunk size we want. Having two controls for the same thing is how we got into the mess of too many ways to control concurrency.
If someone wants a chunk size of 1byte... it's silly but it's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because pget is already deployed to many models which set it
if they set min chunk size to 500MiB we should respect that and not have a 125MiB chunk size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had wired up minchunk size and chunk size to the same value behind the scenes so they should be able to be set either flag but with --minchunk size deprecated.
The exception is in prod where our value would continue to override (since we set with the config map).
The only caveat is if you specified both, the last one processed wins.
I see that I may not have been clear about that change. Totally on me and I'll be better call those things out in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yes I missed that. However:
chunkSize
variable but we never read that variable so it's not obvious to me that it matters (instead we fetch with viper). I don't have a good mental model for what happens? I'm not sure why we bind a variable if we're never reading it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The aliasing is a bit weird with viper involved. Generally using an XXXVarP type instead of XXXP in cobra is the easiest way to alias as it backs to a pointer. I'm really ok either way. Your suggestions do absolutely apply in either case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have viper, again? is it so we can configure via environment variable? it's all a bit magic, I don't understand it, and i don't find the documentation helpful in the detail (like this variable aliasing thing, I don't think the documentation defines the behaviour here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Viper is for the ENV binding to the flags. It's a lot of magic
Variable aliasing results in the last processed element winning i'll mkae sure the arguments cannot be both used. It should address the concerns. The ENV bits is a bit more work I'll make sure it's also clear (or at least documented) behavior