Merge pull request #1596 from balena-io/1594-patch-service-kill-eval

Patch killServicesUsingApi to not get stuck in noop loop
This commit is contained in:
bulldozer-balena[bot] 2021-02-17 12:59:44 +00:00 committed by GitHub
commit b25e8a5b09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -390,16 +390,18 @@ function killServicesUsingApi(current: InstancedAppState): CompositionStep[] {
const steps: CompositionStep[] = [];
_.each(current, (app) => {
_.each(app.services, (service) => {
if (
checkTruthy(
const isUsingSupervisorAPI = checkTruthy(
service.config.labels['io.balena.features.supervisor-api'],
) &&
service.status !== 'Stopping'
) {
);
if (!isUsingSupervisorAPI) {
// No need to stop service as it's not using the Supervisor's API
return steps;
}
if (service.status !== 'Stopping') {
// Stop this service
steps.push(generateStep('kill', { current: service }));
} else {
// We want to output a noop while waiting for a service to stop, as we don't want
// the state application loop to stop while this is ongoing
} else if (service.status === 'Stopping') {
// Wait for the service to finish stopping
steps.push(generateStep('noop', {}));
}
});