优化代码

This commit is contained in:
GoEdgeLab
2022-08-14 16:28:40 +08:00
parent e22473ce00
commit d1c84fb002
7 changed files with 84 additions and 14 deletions

View File

@@ -95,7 +95,8 @@ func (this *MemoryStorage) Init() error {
// 启动定时Flush memory to disk任务
if this.parentStorage != nil {
// TODO 应该根据磁盘性能决定线程数
var threads = 1
// TODO 线程数应该可以在缓存策略和节点中设定
var threads = runtime.NumCPU()
for i := 0; i < threads; i++ {
goman.New(func() {