mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-29 16:34:25 +08:00
keep mq updates in a single go func
This commit is contained in:
parent
3f11ddd8c5
commit
504ce7feb9
1 changed files with 8 additions and 7 deletions
|
@ -258,13 +258,14 @@ func addHostToNetwork(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
logger.Log(1, "added new node", newNode.ID.String(), "to host", currHost.Name)
|
||||
|
||||
mq.HostUpdate(&models.HostUpdate{
|
||||
Action: models.JoinHostToNetwork,
|
||||
Host: *currHost,
|
||||
Node: *newNode,
|
||||
})
|
||||
go mq.PublishPeerUpdate()
|
||||
go func() {
|
||||
mq.HostUpdate(&models.HostUpdate{
|
||||
Action: models.JoinHostToNetwork,
|
||||
Host: *currHost,
|
||||
Node: *newNode,
|
||||
})
|
||||
mq.PublishPeerUpdate()
|
||||
}()
|
||||
logger.Log(2, r.Header.Get("user"), fmt.Sprintf("added host %s to network %s", currHost.Name, network))
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue