mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 06:07:57 +00:00
Merge pull request #782 from balena-io/fix-delete-old-apps
fix: When setting target state, delete old apps from the same source
This commit is contained in:
commit
0d7335bdee
@ -742,6 +742,8 @@ module.exports = class ApplicationManager extends EventEmitter
|
|||||||
.tap (appsForDB) =>
|
.tap (appsForDB) =>
|
||||||
Promise.map appsForDB, (app) =>
|
Promise.map appsForDB, (app) =>
|
||||||
@db.upsertModel('app', app, { appId: app.appId }, trx)
|
@db.upsertModel('app', app, { appId: app.appId }, trx)
|
||||||
|
.then (appsForDB) ->
|
||||||
|
trx('app').where({ source }).whereNotIn('appId', _.map(appsForDB, 'appId')).del()
|
||||||
.then =>
|
.then =>
|
||||||
@proxyvisor.setTargetInTransaction(dependent, trx)
|
@proxyvisor.setTargetInTransaction(dependent, trx)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user