Always send the final progress event

This commit is contained in:
Petros Angelatos 2015-05-05 16:16:36 +01:00 committed by Pablo Carranza Velez
parent 004286a07e
commit f6eafb7b96

View File

@ -51,6 +51,8 @@ exports.rsyncImageWithProgress = (imgDest, onProgress) ->
console.log("#{config.deltaHost}/api/v1/delta?src=#{imgSrc}&dest=#{imgDest}", timeout: 0)
progress request.get("#{config.deltaHost}/api/v1/delta?src=#{imgSrc}&dest=#{imgDest}", timeout: 0)
.on 'progress', onProgress
.on 'end', ->
onProgress(percent: 100)
.on 'response', (res) ->
if res.statusCode isnt 200
reject()