mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tools/benchmark: fix misc gofmt warnings
ref. https://golang.org/cmd/gofmt/#hdr-The_simplify_command Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
817825d549
commit
373a04a181
@ -59,7 +59,7 @@ func leaseKeepaliveFunc(cmd *cobra.Command, args []string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
for _ = range requests {
|
for range requests {
|
||||||
st := time.Now()
|
st := time.Now()
|
||||||
_, err := c.KeepAliveOnce(context.TODO(), resp.ID)
|
_, err := c.KeepAliveOnce(context.TODO(), resp.ID)
|
||||||
r.Results() <- report.Result{Err: err, Start: st, End: time.Now()}
|
r.Results() <- report.Result{Err: err, Start: st, End: time.Now()}
|
||||||
|
@ -129,27 +129,19 @@ func putFunc(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func compactKV(clients []*v3.Client) {
|
func compactKV(clients []*v3.Client) {
|
||||||
var curRev int64
|
|
||||||
for _, c := range clients {
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
resp, err := c.KV.Get(ctx, "foo")
|
resp, err := clients[0].KV.Get(ctx, "foo")
|
||||||
cancel()
|
cancel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
curRev = resp.Header.Revision
|
revToCompact := max(0, resp.Header.Revision-compactIndexDelta)
|
||||||
break
|
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
}
|
_, err = clients[0].KV.Compact(ctx, revToCompact)
|
||||||
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()
|
cancel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func max(n1, n2 int64) int64 {
|
func max(n1, n2 int64) int64 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user