Merge pull request #2175 from resin-io/fix-succeeded-count

fix(writer): Fix succeeded flash count in progress state
This commit is contained in:
Jonas Hermsmeier 2018-04-05 16:42:50 +02:00 committed by GitHub
commit 9a9dd43646
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -397,6 +397,7 @@ class ImageWriter extends EventEmitter {
state.flashing += !dest.error && !dest.finished ? 1 : 0 state.flashing += !dest.error && !dest.finished ? 1 : 0
state.verifying += !dest.error && dest.finished && !dest.verified ? 1 : 0 state.verifying += !dest.error && dest.finished && !dest.verified ? 1 : 0
state.failed += dest.error ? 1 : 0 state.failed += dest.error ? 1 : 0
state.succeeded += !dest.error && dest.finished && (dest.verified || !this.verifyChecksums) ? 1 : 0
if (!(dest.finished && dest.verified) && !dest.error) { if (!(dest.finished && dest.verified) && !dest.error) {
state.totalSpeed += state.type === 'write' state.totalSpeed += state.type === 'write'
? dest.stream.speed ? dest.stream.speed
@ -409,7 +410,6 @@ class ImageWriter extends EventEmitter {
? state.totalSpeed / state.active ? state.totalSpeed / state.active
: state.active : state.active
state.succeeded = state.active - state.failed - state.flashing - state.verifying
state.eta = state.speed ? state.remaining / state.speed : 0 state.eta = state.speed ? state.remaining / state.speed : 0
this.emit('progress', state) this.emit('progress', state)