mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 08:46:56 +08:00
raft cluster
wip: raft does not care about migrating wip: optimize code wip: raft election wip wip: fix raft leader missing log entries wip fix a dead lock batch set slot route wip: raft persist wip refactor cluster suite remove relay rename relay2 refactor: allow customizing client factory test raft refactor re-balance avoid errors caused by inconsistent status on follower nodes during raft commits test raft election
This commit is contained in:
@@ -136,23 +136,23 @@ func (client *Client) Send(args [][]byte) redis.Reply {
|
||||
if atomic.LoadInt32(&client.status) != running {
|
||||
return protocol.MakeErrReply("client closed")
|
||||
}
|
||||
request := &request{
|
||||
req := &request{
|
||||
args: args,
|
||||
heartbeat: false,
|
||||
waiting: &wait.Wait{},
|
||||
}
|
||||
request.waiting.Add(1)
|
||||
req.waiting.Add(1)
|
||||
client.working.Add(1)
|
||||
defer client.working.Done()
|
||||
client.pendingReqs <- request
|
||||
timeout := request.waiting.WaitWithTimeout(maxWait)
|
||||
client.pendingReqs <- req
|
||||
timeout := req.waiting.WaitWithTimeout(maxWait)
|
||||
if timeout {
|
||||
return protocol.MakeErrReply("server time out")
|
||||
}
|
||||
if request.err != nil {
|
||||
return protocol.MakeErrReply("request failed")
|
||||
if req.err != nil {
|
||||
return protocol.MakeErrReply("request failed " + req.err.Error())
|
||||
}
|
||||
return request.reply
|
||||
return req.reply
|
||||
}
|
||||
|
||||
func (client *Client) doHeartbeat() {
|
||||
|
Reference in New Issue
Block a user