Skip to content

Commit

Permalink
fix(main.py): Reset kcidb flag on state change
Browse files Browse the repository at this point in the history
If state changed, likely we need to reprocess the node.

Signed-off-by: Denys Fedoryshchenko <[email protected]>
  • Loading branch information
nuclearcat committed Dec 6, 2024
1 parent 94c174a commit e8de9e8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit e8de9e8

Please sign in to comment.