Skip to content

Commit

Permalink
isolate tag updates for extclient and nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Oct 17, 2024
1 parent de7caba commit 27f276a
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions logic/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,26 +174,32 @@ func UpdateTag(req models.UpdateTagReq, newID models.TagID) {
node.Tags = make(map[models.TagID]struct{})
}
if newID != "" {
node.Tags[newID] = struct{}{}
node.StaticNode.Tags[newID] = struct{}{}
} else {
node.Tags[req.ID] = struct{}{}
node.StaticNode.Tags[req.ID] = struct{}{}
}
if node.IsStatic {
SaveExtClient(&node.StaticNode)
if node.IsStatic {
node.StaticNode.Tags[newID] = struct{}{}
SaveExtClient(&node.StaticNode)
} else {
node.Tags[newID] = struct{}{}
UpsertNode(&node)
}

} else {
UpsertNode(&node)
if node.IsStatic {
node.StaticNode.Tags[req.ID] = struct{}{}
SaveExtClient(&node.StaticNode)
} else {
node.Tags[req.ID] = struct{}{}
UpsertNode(&node)
}
}
} else {
if newID != "" {
delete(node.Tags, req.ID)
delete(node.StaticNode.Tags, req.ID)
node.StaticNode.Tags[newID] = struct{}{}
node.Tags[newID] = struct{}{}
if node.IsStatic {
node.StaticNode.Tags[newID] = struct{}{}
SaveExtClient(&node.StaticNode)
} else {
node.Tags[newID] = struct{}{}
UpsertNode(&node)
}
}
Expand Down

0 comments on commit 27f276a

Please sign in to comment.