Skip to content

Commit

Permalink
Merge pull request etcd-io#7715 from gyuho/fmt
Browse files Browse the repository at this point in the history
tools/benchmark: fix misc gofmt warnings
  • Loading branch information
gyuho authored Apr 12, 2017
2 parents 817825d + 2d97500 commit 2046d66
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi
COVER=${COVER:-"-cover"}

# Hack: gofmt ./ will recursively check the .git directory. So use *.go for gofmt.
IGNORE_PKGS="(cmd|vendor|etcdserverpb|rafttest|gopath.proto|v3lockpb|v3electionpb)"
IGNORE_PKGS="(cmd/|etcdserverpb|rafttest|gopath.proto|v3lockpb|v3electionpb)"
INTEGRATION_PKGS="(integration|e2e|contrib|functional-tester)"

# all github.com/coreos/etcd/whatever pkgs that are not auto-generated / tools
Expand Down
2 changes: 1 addition & 1 deletion tools/benchmark/cmd/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func leaseKeepaliveFunc(cmd *cobra.Command, args []string) {
if err != nil {
panic(err)
}
for _ = range requests {
for range requests {
st := time.Now()
_, err := c.KeepAliveOnce(context.TODO(), resp.ID)
r.Results() <- report.Result{Err: err, Start: st, End: time.Now()}
Expand Down
30 changes: 11 additions & 19 deletions tools/benchmark/cmd/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,26 +129,18 @@ func putFunc(cmd *cobra.Command, args []string) {
}

func compactKV(clients []*v3.Client) {
var curRev int64
for _, c := range clients {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
resp, err := c.KV.Get(ctx, "foo")
cancel()
if err != nil {
panic(err)
}
curRev = resp.Header.Revision
break
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
resp, err := clients[0].KV.Get(ctx, "foo")
cancel()
if err != nil {
panic(err)
}
revToCompact := max(0, curRev-compactIndexDelta)
for _, c := range clients {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
_, err := c.KV.Compact(ctx, revToCompact)
cancel()
if err != nil {
panic(err)
}
break
revToCompact := max(0, resp.Header.Revision-compactIndexDelta)
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
_, err = clients[0].KV.Compact(ctx, revToCompact)
cancel()
if err != nil {
panic(err)
}
}

Expand Down

0 comments on commit 2046d66

Please sign in to comment.