From e8de9e80715214597e90d66a87bfac82caa9142d Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Fri, 6 Dec 2024 00:04:21 +0200 Subject: [PATCH] fix(main.py): Reset kcidb flag on state change If state changed, likely we need to reprocess the node. Signed-off-by: Denys Fedoryshchenko --- api/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/main.py b/api/main.py index fc56aadf..fbf752bd 100644 --- a/api/main.py +++ b/api/main.py @@ -747,6 +747,11 @@ async def put_node(node_id: str, node: Node, status_code=status.HTTP_400_BAD_REQUEST, detail=message ) + # if state changes, reset processed_by_kcidb_bridge flag + if node.state != new_node_def.state: + new_node_def.processed_by_kcidb_bridge = False + # Now we can update the state + new_node_def.state = node.state # KCIDB flags are reset on any update, because this means we need # to reprocess updated node. @@ -756,9 +761,6 @@ async def put_node(node_id: str, node: Node, if old_flag == new_flag: new_node_def.processed_by_kcidb_bridge = False - # Now we can update the state - new_node_def.state = node.state - # Update node in the DB obj = await db.update(new_node_def) data = _get_node_event_data('updated', obj)