mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-04 22:55:48 +08:00
修复检测是否为高速硬盘只能检查sda/vda设备的问题
This commit is contained in:
@@ -1010,10 +1010,13 @@ func (this *Node) reloadServer() {
|
||||
}
|
||||
|
||||
func (this *Node) checkDisk() {
|
||||
if runtime.GOOS == "linux" {
|
||||
if runtime.GOOS != "linux" {
|
||||
return
|
||||
}
|
||||
for n := 'a'; n <= 'z'; n++ {
|
||||
for _, path := range []string{
|
||||
"/sys/block/vda/queue/rotational",
|
||||
"/sys/block/sda/queue/rotational",
|
||||
"/sys/block/vd" + string(n) + "/queue/rotational",
|
||||
"/sys/block/sd" + string(n) + "/queue/rotational",
|
||||
} {
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
@@ -1022,7 +1025,7 @@ func (this *Node) checkDisk() {
|
||||
if string(data) == "0" {
|
||||
teaconst.DiskIsFast = true
|
||||
}
|
||||
break
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user