Skip to content

Commit aecff9f

Browse files
committed
kv: perform local calls in a goroutine
Perform local calls in a goroutine so that they can be cancelled and so that they don't block the caller indefinitely. See #10427
1 parent a67cc0b commit aecff9f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/kv/transport.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,11 @@ func (gt *grpcTransport) SendNext(done chan<- BatchCall) {
181181
client.args.Txn = &clonedTxn
182182
}
183183

184-
reply, err := localServer.Batch(gt.opts.ctx, &client.args)
185-
gt.setPending(client.args.Replica, false)
186-
done <- BatchCall{Reply: reply, Err: err}
184+
go func() {
185+
reply, err := localServer.Batch(gt.opts.ctx, &client.args)
186+
gt.setPending(client.args.Replica, false)
187+
done <- BatchCall{Reply: reply, Err: err}
188+
}()
187189
return
188190
}
189191

0 commit comments

Comments
 (0)