From 7fa6c8dcf63afc17be5e14cddea8debceaa2bee3 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Sat, 25 Sep 2021 13:09:37 +0300 Subject: [PATCH] config: fix duration parameter types These parameters denote seconds and are thus unitless integers, not durations. Signed-off-by: Evgeniy Stratonikov --- pkg/config/application_config.go | 10 ++++------ pkg/network/server_config.go | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pkg/config/application_config.go b/pkg/config/application_config.go index cfae16adb..35dced09f 100644 --- a/pkg/config/application_config.go +++ b/pkg/config/application_config.go @@ -1,8 +1,6 @@ package config import ( - "time" - "github.com/nspcc-dev/neo-go/pkg/core/storage" "github.com/nspcc-dev/neo-go/pkg/network/metrics" "github.com/nspcc-dev/neo-go/pkg/rpc" @@ -14,16 +12,16 @@ type ApplicationConfiguration struct { AnnouncedNodePort uint16 `yaml:"AnnouncedPort"` AttemptConnPeers int `yaml:"AttemptConnPeers"` DBConfiguration storage.DBConfiguration `yaml:"DBConfiguration"` - DialTimeout time.Duration `yaml:"DialTimeout"` + DialTimeout int64 `yaml:"DialTimeout"` LogPath string `yaml:"LogPath"` MaxPeers int `yaml:"MaxPeers"` MinPeers int `yaml:"MinPeers"` NodePort uint16 `yaml:"NodePort"` - PingInterval time.Duration `yaml:"PingInterval"` - PingTimeout time.Duration `yaml:"PingTimeout"` + PingInterval int64 `yaml:"PingInterval"` + PingTimeout int64 `yaml:"PingTimeout"` Pprof metrics.Config `yaml:"Pprof"` Prometheus metrics.Config `yaml:"Prometheus"` - ProtoTickInterval time.Duration `yaml:"ProtoTickInterval"` + ProtoTickInterval int64 `yaml:"ProtoTickInterval"` Relay bool `yaml:"Relay"` RPC rpc.Config `yaml:"RPC"` UnlockWallet Wallet `yaml:"UnlockWallet"` diff --git a/pkg/network/server_config.go b/pkg/network/server_config.go index 4c0f905a6..eff4c53fe 100644 --- a/pkg/network/server_config.go +++ b/pkg/network/server_config.go @@ -103,10 +103,10 @@ func NewServerConfig(cfg config.Config) ServerConfig { Net: protoConfig.Magic, Relay: appConfig.Relay, Seeds: protoConfig.SeedList, - DialTimeout: appConfig.DialTimeout * time.Second, - ProtoTickInterval: appConfig.ProtoTickInterval * time.Second, - PingInterval: appConfig.PingInterval * time.Second, - PingTimeout: appConfig.PingTimeout * time.Second, + DialTimeout: time.Duration(appConfig.DialTimeout) * time.Second, + ProtoTickInterval: time.Duration(appConfig.ProtoTickInterval) * time.Second, + PingInterval: time.Duration(appConfig.PingInterval) * time.Second, + PingTimeout: time.Duration(appConfig.PingTimeout) * time.Second, MaxPeers: appConfig.MaxPeers, AttemptConnPeers: appConfig.AttemptConnPeers, MinPeers: appConfig.MinPeers,