Skip to content

Commit

Permalink
kv: perform local calls in a goroutine
Browse files Browse the repository at this point in the history
Perform local calls in a goroutine so that they can be cancelled and so
that they don't block the caller indefinitely.

See #10427
  • Loading branch information
petermattis committed Nov 23, 2016
1 parent a67cc0b commit aecff9f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/kv/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,11 @@ func (gt *grpcTransport) SendNext(done chan<- BatchCall) {
client.args.Txn = &clonedTxn
}

reply, err := localServer.Batch(gt.opts.ctx, &client.args)
gt.setPending(client.args.Replica, false)
done <- BatchCall{Reply: reply, Err: err}
go func() {
reply, err := localServer.Batch(gt.opts.ctx, &client.args)
gt.setPending(client.args.Replica, false)
done <- BatchCall{Reply: reply, Err: err}
}()
return
}

Expand Down

0 comments on commit aecff9f

Please sign in to comment.