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:
Cedric Charly 2017-06-03 13:44:01 -05:00
parent d3de59bab0
commit ce6706b0d5

View file

@ -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 {