-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(cli): parse URL path and display ETA in reth download
#21014
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
Conversation
reth downloadreth download
pepyakin
left a comment
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.
fine by me
| let elapsed = self.started_at.elapsed(); | ||
| let eta = if self.downloaded > 0 { | ||
| let remaining = self.total_size.saturating_sub(self.downloaded); | ||
| let speed = self.downloaded as f64 / elapsed.as_secs_f64(); |
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.
is it guaranteed that as_secs will always be greater than 0.0?
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.
ye, should be ok
| Duration::ZERO | ||
| } | ||
| } else { | ||
| Duration::ZERO |
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.
do I understand it right that if it does not really progress then the duration is going to be displayed as 0sec?
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.
yep, we can also do ∞ but I think doesn't matter
Allows to pass a path that has query arguments in it but the file itself still has a valid extension. Additionally, displays an ETA.