Merge pull request #326 from resin-io/log-delta-usage

Log whether deltas are being used when downloading an app
This commit is contained in:
Pablo Carranza Vélez 2016-10-24 16:02:36 -03:00 committed by GitHub
commit 3b3d2160b6
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,5 @@
* Log whether deltas are being used when downloading an app [Pablo]
# v2.7.0
* Upgrade docker-progress to v2.3.1 [Pablo]

View File

@ -36,6 +36,9 @@ logTypes =
downloadApp:
eventName: 'Application download'
humanName: 'Downloading application'
downloadAppDelta:
eventName: 'Application delta download'
humanName: 'Downloading delta for application'
downloadAppSuccess:
eventName: 'Application downloaded'
humanName: 'Downloaded application'
@ -182,15 +185,16 @@ fetch = (app, setDeviceUpdateState = true) ->
docker.getImage(app.imageId).inspectAsync()
.catch (error) ->
logSystemEvent(logTypes.downloadApp, app)
device.updateState(status: 'Downloading', download_progress: 0)
Promise.try ->
conf = JSON.parse(app.config)
if conf['RESIN_SUPERVISOR_DELTA'] == '1'
logSystemEvent(logTypes.downloadAppDelta, app)
dockerUtils.rsyncImageWithProgress(app.imageId, onProgress)
else
logSystemEvent(logTypes.downloadApp, app)
dockerUtils.fetchImageWithProgress(app.imageId, onProgress)
.then ->
logSystemEvent(logTypes.downloadAppSuccess, app)