Cleanup, small fixes
parent
5d92e213ee
commit
4dec81e487
|
@ -186,27 +186,34 @@ func getDevicesSpaceUsage(devices []Device) []Device {
|
|||
|
||||
for partitionIndex, partition := range device.Partitions {
|
||||
|
||||
if partition.Mountpoint != "" {
|
||||
|
||||
s, _ := disk.Usage(partition.Mountpoint)
|
||||
|
||||
if s.Total == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
partitionUsagePercent := fmt.Sprintf("%2.f%%", s.UsedPercent)
|
||||
|
||||
edgeappsDirSize, err := getDirSize(utils.GetPath("edgeAppsPath"))
|
||||
// TODO for later: Figure out to get correct paths for each partition...
|
||||
// wsAppDataDirSize, err := getDirSize("/home/system/components/ws/appdata")
|
||||
|
||||
osUsageSplit := (uint64)(0)
|
||||
edgeappsUsageSplit := (uint64)(0)
|
||||
if partition.Mountpoint == "/" && err == nil {
|
||||
// edgeappsUsageSplit = edgeappsDirSize + wsAppDataDirSize
|
||||
edgeappsUsageSplit = edgeappsDirSize
|
||||
bucketsUsageSplit := (uint64)(0)
|
||||
othersUsageSplit := (uint64)(0)
|
||||
|
||||
edgeappsDirSize, _ := getDirSize(utils.GetPath("edgeAppsPath"))
|
||||
// TODO for later: Figure out to get correct paths for each partition...
|
||||
wsAppDataDirSize, _ := getDirSize("/home/system/components/ws/appdata")
|
||||
|
||||
if partition.Mountpoint == "/" {
|
||||
edgeappsUsageSplit = edgeappsDirSize + wsAppDataDirSize
|
||||
deviceUsageStat.UsageSplit.EdgeApps += edgeappsUsageSplit
|
||||
}
|
||||
|
||||
bucketsUsageSplit := (uint64)(0)
|
||||
othersUsageSplit := (uint64)(0)
|
||||
osUsageSplit := (s.Used - othersUsageSplit - bucketsUsageSplit - edgeappsUsageSplit)
|
||||
if device.MainDevice {
|
||||
osUsageSplit = (s.Used - othersUsageSplit - bucketsUsageSplit - edgeappsUsageSplit)
|
||||
} else {
|
||||
othersUsageSplit = (s.Used - bucketsUsageSplit - edgeappsUsageSplit)
|
||||
}
|
||||
|
||||
partitionUsageSplit := UsageSplit{
|
||||
OS: osUsageSplit,
|
||||
|
@ -233,6 +240,8 @@ func getDevicesSpaceUsage(devices []Device) []Device {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
devices[deviceIndex].UsageStat = deviceUsageStat
|
||||
totalDevicePercentUsage := fmt.Sprintf("%2.f%%", (float32(devices[deviceIndex].UsageStat.Used)/float32(devices[deviceIndex].UsageStat.Total))*100)
|
||||
devices[deviceIndex].UsageStat.Percent = totalDevicePercentUsage
|
||||
|
|
|
@ -259,9 +259,13 @@ func ExecuteSchedules(tick int) {
|
|||
|
||||
}
|
||||
|
||||
if tick%5 == 0 {
|
||||
// Executing every 5 ticks
|
||||
log.Println(taskGetStorageDevices())
|
||||
}
|
||||
|
||||
if tick%30 == 0 {
|
||||
// Executing every 30 ticks
|
||||
log.Println(taskGetStorageDevices())
|
||||
log.Println(taskGetEdgeApps())
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue