mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
benchmark: a new option for configuring dial timeout
Current benchmark doesn't have an option for configuring dial timeout of gRPC. This commit adds --dial-timeout for the purpose. It is useful for stopping long sticking benchmarks.
This commit is contained in:
parent
d62ce55584
commit
a662ddefbb
@ -16,6 +16,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/coreos/etcd/pkg/transport"
|
||||
|
||||
@ -49,6 +50,8 @@ var (
|
||||
memProfPath string
|
||||
|
||||
user string
|
||||
|
||||
dialTimeout time.Duration
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -63,4 +66,5 @@ func init() {
|
||||
RootCmd.PersistentFlags().StringVar(&tls.CAFile, "cacert", "", "verify certificates of HTTPS-enabled servers using this CA bundle")
|
||||
|
||||
RootCmd.PersistentFlags().StringVar(&user, "user", "", "specify username and password in username:password format")
|
||||
RootCmd.PersistentFlags().DurationVar(&dialTimeout, "dial-timeout", 0, "dial timeout for client connections")
|
||||
}
|
||||
|
@ -33,7 +33,10 @@ var (
|
||||
func mustCreateConn() *clientv3.Client {
|
||||
endpoint := endpoints[dialTotal%len(endpoints)]
|
||||
dialTotal++
|
||||
cfg := clientv3.Config{Endpoints: []string{endpoint}}
|
||||
cfg := clientv3.Config{
|
||||
Endpoints: []string{endpoint},
|
||||
DialTimeout: dialTimeout,
|
||||
}
|
||||
if !tls.Empty() {
|
||||
cfgtls, err := tls.ClientConfig()
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user