-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Adds get file size method #10
Adds get file size method #10
Conversation
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.
Many thanks for the contribution, @vmesel!
On top of the inline comments, I think I have three further questions:
- having the file size might be a good reason to send
ch <- DownloadStatus{}
imagining the user is building a progress bar, for example; have you considered sending that info through the channel? - on that topic, should we check all the file sizes before starting the download, so then the user knows this info asap?
- are you planning to write tests (and/or need help with that)?
Hey @cuducos, thanks for the reply
It would be a good idea, I don't know a lot about download internals, but I thought that whenever someone starts a download, we already know the size we are expecting to receive. Is it right?
Probably we should be able to do that and even let the user get just the file size from a link he/she/they use on the main command.
Yes, I intend to, but I need some help mocking requests. From my POV, we should mock some requests and send multiple |
Co-authored-by: Eduardo Cuducos <4732915+cuducos@users.noreply.github.com>
Co-authored-by: Eduardo Cuducos <4732915+cuducos@users.noreply.github.com>
Co-authored-by: Eduardo Cuducos <4732915+cuducos@users.noreply.github.com>
Nope. We just know the URL.
In Go we don't use mocks that much, preferring dependency injection. I think that if we propagate the file size in the channel we return to the user, as |
That sounds good to me, @cuducos. That would also make tests easier, as we could benefit from the tests we already have in place. |
Also… should we retry the |
Should it be updated during download ir retried if status code is different than 200? |
Retried in case of failure (e.g. status != 200) |
@cuducos Should this retry method stay inside the getSize function or it should be on the getSize() call? |
I'd say inside, just as the example I linked (high-level function |
Co-authored by: Eduardo Cuducos <cuducos@users.noreply.github.com> Co-authored by: Daniel Fireman <danielfireman@users.noreply.github.com>
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.
Pretty awesome stuff! Almost there!
Co-authored-by: Daniel Fireman <danielfireman@gmail.com>
(I just renamed the PR to better reflect what's being suggested, let me knot if I've messed it up) |
Co-authored-by: Eduardo Cuducos <4732915+cuducos@users.noreply.github.com>
Co-authored by: Eduardo Cuducos <cuducos@users.noreply.github.com>
Co-authored by: Eduardo Cuducos <cuducos@users.noreply.github.com>
Gentlemen, I think we are done with this review. What do you guys think? |
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.
Thanks for going through the changes! It looks good on my side. Only small comments are below.
Co-authored-by: Daniel Fireman <danielfireman@gmail.com>
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.
Minor suggestions, but all good. Let me know if, after adding the TODO
suggested by @danielfireman, you wanna squash your commits (otherwise I do it on my end).
…vmesel/chunk into vmesel-feature/implements-head-request
Co-authored-by: Eduardo Cuducos <4732915+cuducos@users.noreply.github.com>
Co-authored-by: Eduardo Cuducos <4732915+cuducos@users.noreply.github.com>
Co-authored-by: Eduardo Cuducos <4732915+cuducos@users.noreply.github.com>
Co-authored-by: Eduardo Cuducos <4732915+cuducos@users.noreply.github.com>
…hunk into feature/implements-head-request
Gentlemen, "It's time"! Let's merge it? |
Unfortunately, no; the CI is 🔴 for tests and style If you wanna take a quick look, I suggested some quick wins to tackle both issues while revising your code. I just pushed it to a temporary branch. |
Hey, I've seen that you guys are intending to use the Content Size header from the request as a way to get the file size. As I'm learning Go, here is my small contribution to #3.
Am I on the right path, @cuducos?