Skip to content

Commit

Permalink
Merge pull request #450 from influxdb/fix-449-heartbeat-timeouts-caus…
Browse files Browse the repository at this point in the history
…e-lockup

Fix #449. Make heartbeats use a new buffered channel for the response fo...
  • Loading branch information
jvshahid committed Apr 17, 2014
2 parents 2b85296 + a37be46 commit 85dfd7a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cluster/cluster_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ func (self *ClusterServer) heartbeat() {
self.heartbeatStarted = false
}()

responseChan := make(chan *protocol.Response, 1)
heartbeatRequest := &protocol.Request{
Type: &HEARTBEAT_TYPE,
Database: protocol.String(""),
}
for {
// this chan is buffered and in the loop on purpose. This is so
// that if reading a heartbeat times out, and the heartbeat then comes through
// later, it will be dumped into this chan and not block the protobuf client reader.
responseChan := make(chan *protocol.Response, 1)
heartbeatRequest.Id = nil
self.MakeRequest(heartbeatRequest, responseChan)
err := self.getHeartbeatResponse(responseChan)
Expand Down

0 comments on commit 85dfd7a

Please sign in to comment.