diff --git a/pkg/app/piped/apistore/deploymentstore/store.go b/pkg/app/piped/apistore/deploymentstore/store.go index 1f8f508a5d..9bb619cd43 100644 --- a/pkg/app/piped/apistore/deploymentstore/store.go +++ b/pkg/app/piped/apistore/deploymentstore/store.go @@ -123,14 +123,18 @@ func (s *store) sync(ctx context.Context) error { } headDeployments := make(map[string]*model.Deployment) - for _, d := range pendings { + for _, d := range runnings { headDeployments[d.ApplicationId] = d } for _, d := range planneds { - headDeployments[d.ApplicationId] = d + if _, exists := headDeployments[d.ApplicationId]; !exists { + headDeployments[d.ApplicationId] = d + } } - for _, d := range runnings { - headDeployments[d.ApplicationId] = d + for _, d := range pendings { + if _, exists := headDeployments[d.ApplicationId]; !exists { + headDeployments[d.ApplicationId] = d + } } s.plannedDeployments.Store(planneds) diff --git a/pkg/app/pipedv1/apistore/deploymentstore/store.go b/pkg/app/pipedv1/apistore/deploymentstore/store.go index 1f8f508a5d..9bb619cd43 100644 --- a/pkg/app/pipedv1/apistore/deploymentstore/store.go +++ b/pkg/app/pipedv1/apistore/deploymentstore/store.go @@ -123,14 +123,18 @@ func (s *store) sync(ctx context.Context) error { } headDeployments := make(map[string]*model.Deployment) - for _, d := range pendings { + for _, d := range runnings { headDeployments[d.ApplicationId] = d } for _, d := range planneds { - headDeployments[d.ApplicationId] = d + if _, exists := headDeployments[d.ApplicationId]; !exists { + headDeployments[d.ApplicationId] = d + } } - for _, d := range runnings { - headDeployments[d.ApplicationId] = d + for _, d := range pendings { + if _, exists := headDeployments[d.ApplicationId]; !exists { + headDeployments[d.ApplicationId] = d + } } s.plannedDeployments.Store(planneds)