mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-10 17:48:25 +08:00
added force
This commit is contained in:
parent
1e56ecfdb9
commit
49e0545274
1 changed files with 11 additions and 7 deletions
|
@ -107,12 +107,7 @@ func (s *NodeServiceServer) CreateNode(ctx context.Context, req *nodepb.Object)
|
|||
Type: nodepb.NODE_TYPE,
|
||||
}
|
||||
|
||||
var currentServerNode, getErr = logic.GetNetworkServerLeader(node.Network)
|
||||
if getErr == nil {
|
||||
if err := logic.ServerUpdate(¤tServerNode, false); err != nil {
|
||||
logger.Log(1, "server node:", currentServerNode.ID, "failed update")
|
||||
}
|
||||
}
|
||||
runForceServerUpdate(&node)
|
||||
|
||||
go func(node *models.Node) {
|
||||
if node.UDPHolePunch == "yes" {
|
||||
|
@ -221,7 +216,7 @@ func (s *NodeServiceServer) DeleteNode(ctx context.Context, req *nodepb.Object)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
runUpdates(&node, false)
|
||||
runForceServerUpdate(&node)
|
||||
|
||||
return &nodepb.Object{
|
||||
Data: "success",
|
||||
|
@ -313,3 +308,12 @@ func getNodeFromRequestData(data string) (models.Node, error) {
|
|||
func isServer(node *models.Node) bool {
|
||||
return node.IsServer == "yes"
|
||||
}
|
||||
|
||||
func runForceServerUpdate(node *models.Node) {
|
||||
var currentServerNode, getErr = logic.GetNetworkServerLeader(node.Network)
|
||||
if getErr == nil {
|
||||
if err := logic.ServerUpdate(¤tServerNode, false); err != nil {
|
||||
logger.Log(1, "server node:", currentServerNode.ID, "failed update")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue