Skip to content

Commit

Permalink
Increase gRPC request timeout to 45 seconds for sending snapshots
Browse files Browse the repository at this point in the history
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
  • Loading branch information
nishanttotla committed Oct 2, 2017
1 parent 144ddc5 commit 1815b5f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion manager/state/raft/transport/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ func (p *peer) resolveAddr(ctx context.Context, id uint64) (string, error) {
}

func (p *peer) sendProcessMessage(ctx context.Context, m raftpb.Message) error {
ctx, cancel := context.WithTimeout(ctx, p.tr.config.SendTimeout)
timeout := p.tr.config.SendTimeout
// adjust timeout to be higher for when a snapshot is being sent. This
// is to accommodate for the fact that snapshots can be large.
if m.Type == raftpb.MsgSnap {
timeout = 45 * time.Second
}
ctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
_, err := api.NewRaftClient(p.conn()).ProcessRaftMessage(ctx, &api.ProcessRaftMessageRequest{Message: &m})
if grpc.Code(err) == codes.NotFound && grpc.ErrorDesc(err) == membership.ErrMemberRemoved.Error() {
Expand Down

0 comments on commit 1815b5f

Please sign in to comment.