mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-20 09:46:19 +00:00
state-engine: Return a noop when waiting for a dependency
We run the risk of the state engine exiting early when a dependency is not ready, especially in local mode. This changes forces a noop to be returned when we are waiting on another service, which is the process used elsewhere in the state engine. Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
8f2d6f4d7b
commit
84356b82b8
@ -547,7 +547,7 @@ module.exports = class ApplicationManager extends EventEmitter
|
||||
# We only kill when dependencies are already met, so that we minimize downtime
|
||||
return serviceAction('kill', target.serviceId, current, target)
|
||||
else
|
||||
return null
|
||||
return { action: 'noop' }
|
||||
'kill-then-download': (current, target) ->
|
||||
return serviceAction('kill', target.serviceId, current, target)
|
||||
'delete-then-download': (current, target) ->
|
||||
@ -560,7 +560,7 @@ module.exports = class ApplicationManager extends EventEmitter
|
||||
else if dependenciesMetForStart()
|
||||
return serviceAction('handover', target.serviceId, current, target, timeout: timeout)
|
||||
else
|
||||
return null
|
||||
return { action: 'noop' }
|
||||
}
|
||||
|
||||
_nextStepForService: ({ current, target }, updateContext, localMode) =>
|
||||
|
@ -257,12 +257,12 @@ describe 'ApplicationManager', ->
|
||||
@normaliseTarget(targetState[4], availableImages[2])
|
||||
(current, target) =>
|
||||
steps = @applications._inferNextSteps(false, availableImages[2], [], true, current, target, false, {})
|
||||
expect(steps).to.eventually.deep.equal([{
|
||||
expect(steps).to.eventually.have.deep.members([{
|
||||
action: 'fetch'
|
||||
image: @applications.imageForService(target.local.apps[0].services[0])
|
||||
serviceId: 23
|
||||
appId: 1234
|
||||
}])
|
||||
}, { action: 'noop', appId: 1234 }])
|
||||
)
|
||||
|
||||
it 'infers to kill several services as long as there is no unmet dependency', ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user