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 5, 2024
1 parent 94c174a commit bd43e16
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,12 @@ 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

Check warning on line 757 in api/main.py

View workflow job for this annotation

GitHub Actions / Lint

too many blank lines (2)
# to reprocess updated node.
Expand All @@ -756,8 +762,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

Check warning on line 766 in api/main.py

View workflow job for this annotation

GitHub Actions / Lint

too many blank lines (2)
obj = await db.update(new_node_def)
Expand Down

0 comments on commit bd43e16

Please sign in to comment.