From 71eb9fb767b92fe945d0f9e040eab427d76fdca6 Mon Sep 17 00:00:00 2001 From: Leo Balduf Date: Fri, 12 May 2017 13:16:39 +0200 Subject: [PATCH] storage/config: fix example config, add warning for missing shardCount --- example_config.yaml | 2 +- storage/memory/peer_store.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/example_config.yaml b/example_config.yaml index 58ecb58..4ec8aa0 100644 --- a/example_config.yaml +++ b/example_config.yaml @@ -68,7 +68,7 @@ chihaya: # The number of partitions data will be divided into in order to provide a # higher degree of parallelism. - shards: 1024 + shard_count: 1024 # This block defines configuration used for middleware executed before a # response has been returned to a BitTorrent client. diff --git a/storage/memory/peer_store.go b/storage/memory/peer_store.go index f736727..84e4194 100644 --- a/storage/memory/peer_store.go +++ b/storage/memory/peer_store.go @@ -63,9 +63,12 @@ func (cfg Config) LogFields() log.Fields { // New creates a new PeerStore backed by memory. func New(cfg Config) (storage.PeerStore, error) { - shardCount := 1 + var shardCount int if cfg.ShardCount > 0 { shardCount = cfg.ShardCount + } else { + log.Warnln("storage: shardCount not configured, using 1 as default value.") + shardCount = 1 } if cfg.GarbageCollectionInterval <= 0 {