mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 16:00:25 +08:00 
			
		
		
		
	优化代码
This commit is contained in:
		@@ -61,8 +61,6 @@ const (
 | 
			
		||||
var sharedWritingFileKeyMap = map[string]zero.Zero{} // key => bool
 | 
			
		||||
var sharedWritingFileKeyLocker = sync.Mutex{}
 | 
			
		||||
 | 
			
		||||
const protectingLoadWhenDump = false
 | 
			
		||||
 | 
			
		||||
// FileStorage 文件缓存
 | 
			
		||||
//
 | 
			
		||||
//	文件结构:
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/trackers"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/utils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/utils/fasttime"
 | 
			
		||||
	fsutils "github.com/TeaOSLab/EdgeNode/internal/utils/fs"
 | 
			
		||||
	setutils "github.com/TeaOSLab/EdgeNode/internal/utils/sets"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/utils/sizes"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeNode/internal/zero"
 | 
			
		||||
@@ -483,7 +484,8 @@ func (this *MemoryStorage) startFlush() {
 | 
			
		||||
		if statCount == 100 {
 | 
			
		||||
			statCount = 0
 | 
			
		||||
 | 
			
		||||
			if protectingLoadWhenDump {
 | 
			
		||||
			// delay some time to reduce load if needed
 | 
			
		||||
			if !fsutils.DiskIsFast {
 | 
			
		||||
				loadStat, err := load.Avg()
 | 
			
		||||
				if err == nil && loadStat != nil {
 | 
			
		||||
					if loadStat.Load1 > 10 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user