mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-29 18:33:05 +00:00
Reduce the mutex size when the client closes the connection
This commit is contained in:
parent
cb1a81fe4c
commit
5db7716be2
1 changed files with 1 additions and 1 deletions
2
api.go
2
api.go
|
@ -320,11 +320,11 @@ func (h *Headscale) PollNetMapHandler(c *gin.Context) {
|
||||||
return true
|
return true
|
||||||
|
|
||||||
case <-c.Request.Context().Done():
|
case <-c.Request.Context().Done():
|
||||||
h.pollMu.Lock()
|
|
||||||
log.Printf("[%s] The client has closed the connection", m.Name)
|
log.Printf("[%s] The client has closed the connection", m.Name)
|
||||||
now := time.Now().UTC()
|
now := time.Now().UTC()
|
||||||
m.LastSeen = &now
|
m.LastSeen = &now
|
||||||
db.Save(&m)
|
db.Save(&m)
|
||||||
|
h.pollMu.Lock()
|
||||||
cancelKeepAlive <- []byte{}
|
cancelKeepAlive <- []byte{}
|
||||||
delete(h.clientsPolling, m.ID)
|
delete(h.clientsPolling, m.ID)
|
||||||
close(update)
|
close(update)
|
||||||
|
|
Loading…
Reference in a new issue