Merge pull request #40 from resin-io/assign-containerid-before-logger-attach

Bugfix: assign app.containerId before attaching logger
This commit is contained in:
Pablo Carranza Vélez 2015-12-07 10:11:04 -08:00
commit 7f9683182e

View File

@ -225,11 +225,11 @@ application.start = start = (app) ->
logSystemEvent(logTypes.startAppError, app, err)
throw err
.then ->
app.containerId = container.id
device.updateState(commit: app.commit)
logger.attach(app)
.tap (container) ->
# Update the app info, only if starting the container worked.
app.containerId = container.id
knex('app').update(app).where(appId: app.appId)
.then (affectedRows) ->
knex('app').insert(app) if affectedRows == 0