mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
fix(writer): Fix writer progress state values
This force-defaults the individual stream speeds to zero, in order to avoid null values when not available yet. Change-Type: patch
This commit is contained in:
parent
64604dbcc6
commit
f119ca683e
@ -400,15 +400,15 @@ class ImageWriter extends EventEmitter {
|
||||
state.succeeded += !dest.error && dest.finished && (dest.verified || !this.verifyChecksums) ? 1 : 0
|
||||
if (!(dest.finished && dest.verified) && !dest.error) {
|
||||
state.totalSpeed += state.type === 'write'
|
||||
? dest.stream.speed
|
||||
: dest.progress.state.speed
|
||||
? (dest.stream.speed || 0)
|
||||
: (dest.progress.state.speed || 0)
|
||||
state.active += 1
|
||||
}
|
||||
})
|
||||
|
||||
state.speed = state.active
|
||||
? state.totalSpeed / state.active
|
||||
: state.active
|
||||
: state.totalSpeed
|
||||
|
||||
state.eta = state.speed ? state.remaining / state.speed : 0
|
||||
|
||||
|
@ -56,6 +56,7 @@ class ProgressStream extends Stream.Transform {
|
||||
remaining: 0,
|
||||
runtime: 0,
|
||||
speed: 0,
|
||||
totalSpeed: 0,
|
||||
transferred: 0
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user