Skip to content

Commit

Permalink
client: clean up control flow in the Batch method
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Aug 12, 2021
1 parent 92fcb99 commit 251ec81
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,17 @@ func (c *Client) CallResult(ctx context.Context, method string, params, result i
func (c *Client) Batch(ctx context.Context, specs []Spec) ([]*Response, error) {
reqs := make(jmessages, len(specs))
for i, spec := range specs {
var req *jmessage
var err error
if spec.Notify {
req, err := c.note(ctx, spec.Method, spec.Params)
if err != nil {
return nil, err
}
reqs[i] = req
} else if req, err := c.req(ctx, spec.Method, spec.Params); err != nil {
return nil, err
req, err = c.note(ctx, spec.Method, spec.Params)
} else {
reqs[i] = req
req, err = c.req(ctx, spec.Method, spec.Params)
}
if err != nil {
return nil, err
}
reqs[i] = req
}
rsps, err := c.send(ctx, reqs)
if err != nil {
Expand Down

0 comments on commit 251ec81

Please sign in to comment.