Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
avoid concurrent write to websocket when sending keep-alive messages
Browse files Browse the repository at this point in the history
fixes #213

this probably only happen in very busy clusters :)
  • Loading branch information
jippi committed Mar 17, 2017
1 parent 648fe60 commit 70b5faf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions backend/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type Action struct {
}

const (
keepAlive = "INTERNAL_KEEP_ALIVE"
errorNotification = "ERROR_NOTIFICATION"
successNotification = "SUCCESS_NOTIFICATION"
)
2 changes: 1 addition & 1 deletion backend/nomad_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (c *NomadConnection) keepAlive() {
return
case <-ticker.C:
logger.Debugf("Sending keep-alive packet")
c.socket.WriteMessage(websocket.PingMessage, []byte("keepalive"))
c.send <- &Action{Type: keepAlive, Payload: "hello-world", Index: 0}
}
}
}
Expand Down

0 comments on commit 70b5faf

Please sign in to comment.