We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa11dae commit f84231fCopy full SHA for f84231f
roachpb/batch.go
@@ -62,8 +62,13 @@ func (ba *BatchRequest) IsRange() bool {
62
63
// GetArg returns the first request of the given type, if possible.
64
func (ba *BatchRequest) GetArg(method Method) (Request, bool) {
65
- // TODO(tschottdorf): when looking for EndTransaction, just look at the
66
- // last entry.
+ // when looking for EndTransaction, just look at the last entry.
+ if length := len(ba.Requests); length > 0 && method == EndTransaction {
67
+ if req := ba.Requests[length-1].GetInner(); req.Method() == EndTransaction {
68
+ return req, true
69
+ }
70
71
+
72
for _, arg := range ba.Requests {
73
if req := arg.GetInner(); req.Method() == method {
74
return req, true
0 commit comments