Prevent shadowing processes

This commit is contained in:
Ingo Oppermann
2025-07-21 15:33:59 +02:00
parent fbddaf3de7
commit d64c7b377e

View File

@@ -61,7 +61,17 @@ func (h *ClusterHandler) ProcessList(c echo.Context) error {
continue
}
pmap[app.NewProcessID(p.ID, p.Domain)] = p
pid := app.NewProcessID(p.ID, p.Domain)
proc, ok := pmap[pid]
if ok {
// While moving a process from one node to another, they exist on both nodes.
// This will select the latest incarnation of this process.
if p.CreatedAt < proc.CreatedAt {
continue
}
}
pmap[pid] = p
}
missing := []api.Process{}
@@ -76,6 +86,14 @@ func (h *ClusterHandler) ProcessList(c echo.Context) error {
continue
}
// Prevent overshadowing existing processes with undeployed changes.
// TODO: should undeployed changes be visible in a process config/state? They
// are visible in the store process list, however.
if _, ok := pmap[p.Config.ProcessID()]; ok {
continue
}
/*
// Check if the process has been deployed
if len(p.Error) == 0 {
if _, ok := pmap[p.Config.ProcessID()]; ok {
@@ -84,7 +102,7 @@ func (h *ClusterHandler) ProcessList(c echo.Context) error {
} else {
delete(pmap, p.Config.ProcessID())
}
*/
process := api.Process{}
process.UnmarshalStore(p, filter.config, filter.state, filter.report, filter.metadata)