From ccfa8a4a78f51e81bed877c8336e3de6141d3774 Mon Sep 17 00:00:00 2001 From: Nao Nishijima Date: Tue, 10 May 2022 13:39:38 +0900 Subject: [PATCH] Remove an unused config parameter from peer After the commit of 6c58b2, a config parameter 'DeliverClientKeepaliveOptions' is no longer used. Signed-off-by: Nao Nishijima --- core/deliverservice/config.go | 6 ------ core/deliverservice/config_test.go | 6 ++---- core/peer/config.go | 12 ------------ core/peer/config_test.go | 21 +++++++++------------ sampleconfig/core.yaml | 10 ---------- 5 files changed, 11 insertions(+), 44 deletions(-) diff --git a/core/deliverservice/config.go b/core/deliverservice/config.go index 09af248f052..399c8036f7b 100644 --- a/core/deliverservice/config.go +++ b/core/deliverservice/config.go @@ -142,12 +142,6 @@ func (c *DeliverServiceConfig) loadDeliverServiceConfig() { } c.KeepaliveOptions = comm.DefaultKeepaliveOptions - if viper.IsSet("peer.keepalive.deliveryClient.interval") { - c.KeepaliveOptions.ClientInterval = viper.GetDuration("peer.keepalive.deliveryClient.interval") - } - if viper.IsSet("peer.keepalive.deliveryClient.timeout") { - c.KeepaliveOptions.ClientTimeout = viper.GetDuration("peer.keepalive.deliveryClient.timeout") - } c.SecOpts = comm.SecureOptions{ UseTLS: viper.GetBool("peer.tls.enabled"), diff --git a/core/deliverservice/config_test.go b/core/deliverservice/config_test.go index b3658bb83a6..85432aa2ebf 100644 --- a/core/deliverservice/config_test.go +++ b/core/deliverservice/config_test.go @@ -86,8 +86,6 @@ func TestGlobalConfig(t *testing.T) { viper.Set("peer.deliveryclient.reConnectBackoffThreshold", "25s") viper.Set("peer.deliveryclient.reconnectTotalTimeThreshold", "20s") viper.Set("peer.deliveryclient.connTimeout", "10s") - viper.Set("peer.keepalive.deliveryClient.interval", "5s") - viper.Set("peer.keepalive.deliveryClient.timeout", "2s") coreConfig := deliverservice.GlobalConfig() @@ -98,8 +96,8 @@ func TestGlobalConfig(t *testing.T) { ReconnectTotalTimeThreshold: 20 * time.Second, ConnectionTimeout: 10 * time.Second, KeepaliveOptions: comm.KeepaliveOptions{ - ClientInterval: time.Second * 5, - ClientTimeout: time.Second * 2, + ClientInterval: time.Second * 60, + ClientTimeout: time.Second * 20, ServerInterval: time.Hour * 2, ServerTimeout: time.Second * 20, ServerMinInterval: time.Minute, diff --git a/core/peer/config.go b/core/peer/config.go index c3103685592..4847aba2da0 100644 --- a/core/peer/config.go +++ b/core/peer/config.go @@ -79,10 +79,6 @@ type Config struct { // hardware threads on the machine. ValidatorPoolSize int - // ----- Peer Delivery Client Keepalive ----- - // DeliveryClient Keepalive settings for communication with ordering nodes. - DeliverClientKeepaliveOptions comm.KeepaliveOptions - // ----- Profile ----- // TODO: create separate sub-struct for Profile config. @@ -271,14 +267,6 @@ func (c *Config) load() error { c.ValidatorPoolSize = runtime.NumCPU() } - c.DeliverClientKeepaliveOptions = comm.DefaultKeepaliveOptions - if viper.IsSet("peer.keepalive.deliveryClient.interval") { - c.DeliverClientKeepaliveOptions.ClientInterval = viper.GetDuration("peer.keepalive.deliveryClient.interval") - } - if viper.IsSet("peer.keepalive.deliveryClient.timeout") { - c.DeliverClientKeepaliveOptions.ClientTimeout = viper.GetDuration("peer.keepalive.deliveryClient.timeout") - } - c.GatewayOptions = gatewayconfig.GetOptions(viper.GetViper()) c.VMEndpoint = viper.GetString("vm.endpoint") diff --git a/core/peer/config_test.go b/core/peer/config_test.go index c2092eee888..dba138be6d2 100644 --- a/core/peer/config_test.go +++ b/core/peer/config_test.go @@ -346,7 +346,6 @@ func TestGlobalConfig(t *testing.T) { ChaincodeListenAddress: "0.0.0.0:7052", ChaincodeAddress: "0.0.0.0:7052", ValidatorPoolSize: 1, - DeliverClientKeepaliveOptions: comm.DefaultKeepaliveOptions, VMEndpoint: "unix:///var/run/docker.sock", VMDockerTLSEnabled: false, @@ -402,12 +401,11 @@ func TestGlobalConfigDefault(t *testing.T) { require.NoError(t, err) expectedConfig := &Config{ - AuthenticationTimeWindow: 15 * time.Minute, - PeerAddress: "localhost:8080", - ValidatorPoolSize: runtime.NumCPU(), - VMNetworkMode: "host", - DeliverClientKeepaliveOptions: comm.DefaultKeepaliveOptions, - GatewayOptions: config.GetOptions(viper.GetViper()), + AuthenticationTimeWindow: 15 * time.Minute, + PeerAddress: "localhost:8080", + ValidatorPoolSize: runtime.NumCPU(), + VMNetworkMode: "host", + GatewayOptions: config.GetOptions(viper.GetViper()), } require.Equal(t, expectedConfig, coreConfig) @@ -438,11 +436,10 @@ func TestPropagateEnvironment(t *testing.T) { require.NoError(t, err) expectedConfig := &Config{ - AuthenticationTimeWindow: 15 * time.Minute, - PeerAddress: "localhost:8080", - ValidatorPoolSize: runtime.NumCPU(), - VMNetworkMode: "host", - DeliverClientKeepaliveOptions: comm.DefaultKeepaliveOptions, + AuthenticationTimeWindow: 15 * time.Minute, + PeerAddress: "localhost:8080", + ValidatorPoolSize: runtime.NumCPU(), + VMNetworkMode: "host", ExternalBuilders: []ExternalBuilder{ { Name: "testName", diff --git a/sampleconfig/core.yaml b/sampleconfig/core.yaml index 9f6a99ed938..3ad33a0275b 100644 --- a/sampleconfig/core.yaml +++ b/sampleconfig/core.yaml @@ -79,16 +79,6 @@ peer: # Timeout is the duration the client waits for a response from # peer nodes before closing the connection timeout: 20s - # DeliveryClient keepalive settings for communication with ordering - # nodes. - deliveryClient: - # Interval is the time between pings to ordering nodes. This must - # greater than or equal to the minInterval specified by ordering - # nodes. - interval: 60s - # Timeout is the duration the client waits for a response from - # ordering nodes before closing the connection - timeout: 20s # Gossip related configuration