fix(convergence): Serialize access to observed state

Signed-off-by: Ananta Dwi Prasetya Purna Yuda <hi@anantadwi13.com>
This commit is contained in:
Ananta Dwi Prasetya Purna Yuda 2024-09-22 03:05:57 +00:00 committed by Nicolas De loof
parent 41df35c1f4
commit bdb8545611
1 changed files with 2 additions and 2 deletions

View File

@ -223,7 +223,7 @@ func (c *convergence) stopDependentContainers(ctx context.Context, project *type
// Stop dependent containers, so they will be restarted after service is re-created
dependents := project.GetDependentsForService(service)
for _, name := range dependents {
dependents := c.observedState[name]
dependents := c.getObservedState(name)
err := c.service.stopContainers(ctx, w, dependents, nil)
if err != nil {
return err
@ -232,7 +232,7 @@ func (c *convergence) stopDependentContainers(ctx context.Context, project *type
dependent.State = ContainerExited
dependents[i] = dependent
}
c.observedState[name] = dependents
c.setObservedState(name, dependents)
}
return nil
}