Merge pull request #315 from mrd0ll4r/fix-config

storage/config: fix example config, add warning for missing shardCount
This commit is contained in:
mrd0ll4r 2017-05-12 20:23:22 +02:00 committed by GitHub
commit 48abc6048e
2 changed files with 5 additions and 2 deletions

View file

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

View file

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