Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
fix(download-progress): only calculate ETA when seconds is finite number
Browse files Browse the repository at this point in the history
  • Loading branch information
devinus committed Jan 28, 2019
1 parent 75f29b7 commit 3e0cb2b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/components/download-progress/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ export default class DownloadProgressComponent extends Component.extend(
updateProgress(value) {
const delta = value - this.get('value');
const speed = this.speed(delta);
const remaining = 1 - value;
const remaining = Math.max(0, 1 - value);
const seconds = Math.round(remaining / speed);
const eta = moment().add(seconds, 'second').toDate();
const eta = Number.isFinite(seconds)
? moment().add(seconds, 'second').toDate()
: null;
this.setProperties({ value, eta });
}
}

0 comments on commit 3e0cb2b

Please sign in to comment.