Skip to content

Commit

Permalink
Always add full timeout for client RPC deadline
Browse files Browse the repository at this point in the history
When an RPC with a blocking query is retried the deadline should include
the max query time, not just the remaining time in the initial query.
A query may block up to twice as long as requested if any retries occur.
  • Loading branch information
wjordan committed Nov 24, 2021
1 parent c4ad24f commit d6e2cbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion agent/consul/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ TRY:

var deadline time.Time
if info != nil {
deadline = firstCheck.Add(info.Timeout(c.config.RPCHoldTimeout, c.config.MaxQueryTime, c.config.DefaultQueryTime))
deadline = time.Now().Add(info.Timeout(c.config.RPCHoldTimeout, c.config.MaxQueryTime, c.config.DefaultQueryTime))
} else {
deadline = time.Time{}
}
Expand Down

0 comments on commit d6e2cbb

Please sign in to comment.