diff options
| author | Chris Lu <chris.lu@uber.com> | 2019-03-17 22:32:01 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@uber.com> | 2019-03-17 22:32:01 -0700 |
| commit | 8b26d1574005a993659245599d3db40d3308e011 (patch) | |
| tree | 656ee7be326e5828e108378114cecba36244410b | |
| parent | 2fcc88116eafbf88a1d757a924cefe66cf8ffc74 (diff) | |
| download | seaweedfs-8b26d1574005a993659245599d3db40d3308e011.tar.xz seaweedfs-8b26d1574005a993659245599d3db40d3308e011.zip | |
refactoring: simplify function parameter
| -rw-r--r-- | weed/storage/disk_location.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go index 9589d9281..cd81b2210 100644 --- a/weed/storage/disk_location.go +++ b/weed/storage/disk_location.go @@ -63,14 +63,7 @@ func (l *DiskLocation) loadExistingVolume(dir os.FileInfo, needleMapKind NeedleM } } -func (l *DiskLocation) concurrentLoadingVolumes(needleMapKind NeedleMapType, concurrentFlag bool) { - var concurrency int - if concurrentFlag { - //You could choose a better optimized concurency value after testing at your environment - concurrency = 10 - } else { - concurrency = 1 - } +func (l *DiskLocation) concurrentLoadingVolumes(needleMapKind NeedleMapType, concurrency int) { task_queue := make(chan os.FileInfo, 10*concurrency) go func() { @@ -101,7 +94,7 @@ func (l *DiskLocation) loadExistingVolumes(needleMapKind NeedleMapType) { l.Lock() defer l.Unlock() - l.concurrentLoadingVolumes(needleMapKind, true) + l.concurrentLoadingVolumes(needleMapKind, 10) glog.V(0).Infoln("Store started on dir:", l.Directory, "with", len(l.volumes), "volumes", "max", l.MaxVolumeCount) } |
