switched to the new converter instead of the formatter functions to convert byte sizes
This commit is contained in:
parent
1cf8430ad8
commit
3d4a2128e2
2 changed files with 5 additions and 13 deletions
|
@ -156,15 +156,7 @@ public static class Formatter
|
|||
return (i / (1024D * 1024D)).Round(2) + " GB";
|
||||
}
|
||||
}
|
||||
|
||||
public static double BytesToGb(long bytes)
|
||||
{
|
||||
const double gbMultiplier = 1024 * 1024 * 1024; // 1 GB = 1024 MB * 1024 KB * 1024 B
|
||||
|
||||
double gigabytes = (double)bytes / gbMultiplier;
|
||||
return gigabytes;
|
||||
}
|
||||
|
||||
public static RenderFragment FormatLineBreaks(string content)
|
||||
{
|
||||
return builder =>
|
||||
|
|
|
@ -93,14 +93,14 @@ public class CleanupService
|
|||
Logger.Debug($"Max CPU: {maxCpu}");
|
||||
executeCleanup = true;
|
||||
}
|
||||
else if (Formatter.BytesToGb(memoryMetrics.Total) - Formatter.BytesToGb(memoryMetrics.Used) <
|
||||
minMemory / 1024D)
|
||||
else if (ByteSizeValue.FromKiloBytes(memoryMetrics.Total).MegaBytes - ByteSizeValue.FromKiloBytes(memoryMetrics.Used).MegaBytes <
|
||||
minMemory)
|
||||
{
|
||||
Logger.Debug($"{node.Name}: Memory Usage is too high");
|
||||
Logger.Debug($"Memory (Total): {Formatter.BytesToGb(memoryMetrics.Total)}");
|
||||
Logger.Debug($"Memory (Used): {Formatter.BytesToGb(memoryMetrics.Used)}");
|
||||
Logger.Debug($"Memory (Total): {ByteSizeValue.FromKiloBytes(memoryMetrics.Total).MegaBytes}");
|
||||
Logger.Debug($"Memory (Used): {ByteSizeValue.FromKiloBytes(memoryMetrics.Used).MegaBytes}");
|
||||
Logger.Debug(
|
||||
$"Memory (Free): {Formatter.BytesToGb(memoryMetrics.Total) - Formatter.BytesToGb(memoryMetrics.Used)}");
|
||||
$"Memory (Free): {ByteSizeValue.FromKiloBytes(memoryMetrics.Total).MegaBytes - ByteSizeValue.FromKiloBytes(memoryMetrics.Used).MegaBytes}");
|
||||
Logger.Debug($"Min Memory: {minMemory}");
|
||||
executeCleanup = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue