Write node to DB every signal

gql_cataclysm v0.3.0
noah metz 2023-07-31 16:37:32 -06:00
parent 771bf53356
commit 887a976263
1 changed files with 7 additions and 0 deletions

@ -252,6 +252,13 @@ func nodeLoop(ctx *Context, node *Node) error {
} }
node.Process(ctx, source, signal) node.Process(ctx, source, signal)
// assume that processing a signal means that this nodes state changed
// TODO: remove a lot of database writes by only writing when things change,
// so need to have Process return whether or not state changed
err := WriteNode(ctx, node)
if err != nil {
panic(err)
}
} }
stopped := node.Active.CompareAndSwap(true, false) stopped := node.Active.CompareAndSwap(true, false)