storage/memory: set default prometheus_reporting_interval
When left blank in the config, the default prometheus_reporting_interval value defaulted to 0, causing a panic during peer store initialization. This change sets the default value to 1 if not provided. Fixes #319
This commit is contained in:
parent
d3de59bab0
commit
ce6706b0d5
1 changed files with 4 additions and 0 deletions
|
@ -125,6 +125,10 @@ func New(cfg Config) (storage.PeerStore, error) {
|
|||
ps.wg.Add(1)
|
||||
go func() {
|
||||
defer ps.wg.Done()
|
||||
if cfg.PrometheusReportingInterval <= 0 {
|
||||
cfg.PrometheusReportingInterval = 1
|
||||
log.Warn("storage: PrometheusReportingInterval not specified/invalid, defaulting to 1 second")
|
||||
}
|
||||
t := time.NewTicker(cfg.PrometheusReportingInterval)
|
||||
for {
|
||||
select {
|
||||
|
|
Loading…
Reference in a new issue