From 464660651ddf7e8938a0fbb03f140502180a8062 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 4 Aug 2016 02:10:44 +0200 Subject: [PATCH] rpc: don't exceed context deadline while waiting for send lock --- rpc/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rpc/client.go b/rpc/client.go index 4ff9a8cb9a..0c52402ea6 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -398,6 +398,10 @@ func (c *Client) send(ctx context.Context, op *requestOp, msg interface{}) error err := c.write(ctx, msg) c.sendDone <- err return err + case <-ctx.Done(): + // This can happen if the client is overloaded or unable to keep up with + // subscription notifications. + return ctx.Err() case <-c.didQuit: return ErrClientQuit }