engine: Create a resource kind+name specific stateful store

This adds a meta state store that is preserved between graph switches if
the kind and name match. This is useful so that rapid graph changes
don't necessarily reset their retry count if they've only changed one
resource field.
This commit is contained in:
James Shubin
2023-09-01 20:45:12 -04:00
parent 07bd8afc4a
commit 9545e409d4
7 changed files with 106 additions and 1 deletions

View File

@@ -256,6 +256,11 @@ func (obj *Engine) Worker(vertex pgraph.Vertex) error {
return fmt.Errorf("permanently limited (rate != Inf, burst = 0)")
}
// initialize or reinitialize the meta state for this resource uid
if _, exists := obj.metas[engine.PtrUID(res)]; !exists || res.MetaParams().Reset {
obj.metas[engine.PtrUID(res)] = &engine.MetaState{}
}
//defer close(obj.state[vertex].stopped) // done signal
obj.state[vertex].cuid = obj.Converger.Register()