mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 14:13:08 +00:00
Update the app info the moment we create the container, even if then starting the container fails.
This stops issues with constantly creating new containers for an image that fails to start.
This commit is contained in:
parent
a6cc3da440
commit
a9fe6f3414
@ -121,6 +121,14 @@ exports.start = start = (app) ->
|
||||
Env: _.map env, (v, k) -> k + '=' + v
|
||||
ExposedPorts: ports
|
||||
)
|
||||
.tap (container) ->
|
||||
# Update the app info the moment we create the container, even if then starting the container fails.
|
||||
# This stops issues with constantly creating new containers for an image that fails to start.
|
||||
app.containerId = container.id
|
||||
if app.id?
|
||||
knex('app').update(app).where(id: app.id)
|
||||
else
|
||||
knex('app').insert(app)
|
||||
.tap (container) ->
|
||||
console.log('Starting container:', app.imageId)
|
||||
ports = {}
|
||||
@ -144,13 +152,8 @@ exports.start = start = (app) ->
|
||||
es.split()
|
||||
es.mapSync(publish)
|
||||
)
|
||||
.tap (container) ->
|
||||
.tap ->
|
||||
utils.mixpanelTrack('Application start', app.imageId)
|
||||
app.containerId = container.id
|
||||
if app.id?
|
||||
knex('app').update(app).where(id: app.id)
|
||||
else
|
||||
knex('app').insert(app)
|
||||
.finally ->
|
||||
updateDeviceInfo(status: 'Idle')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user