switched to the new converter instead of the formatter functions to convert byte sizes
This commit is contained in:
@@ -157,14 +157,6 @@ public static class Formatter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
public static RenderFragment FormatLineBreaks(string content)
|
||||||
{
|
{
|
||||||
return builder =>
|
return builder =>
|
||||||
|
|||||||
@@ -93,14 +93,14 @@ public class CleanupService
|
|||||||
Logger.Debug($"Max CPU: {maxCpu}");
|
Logger.Debug($"Max CPU: {maxCpu}");
|
||||||
executeCleanup = true;
|
executeCleanup = true;
|
||||||
}
|
}
|
||||||
else if (Formatter.BytesToGb(memoryMetrics.Total) - Formatter.BytesToGb(memoryMetrics.Used) <
|
else if (ByteSizeValue.FromKiloBytes(memoryMetrics.Total).MegaBytes - ByteSizeValue.FromKiloBytes(memoryMetrics.Used).MegaBytes <
|
||||||
minMemory / 1024D)
|
minMemory)
|
||||||
{
|
{
|
||||||
Logger.Debug($"{node.Name}: Memory Usage is too high");
|
Logger.Debug($"{node.Name}: Memory Usage is too high");
|
||||||
Logger.Debug($"Memory (Total): {Formatter.BytesToGb(memoryMetrics.Total)}");
|
Logger.Debug($"Memory (Total): {ByteSizeValue.FromKiloBytes(memoryMetrics.Total).MegaBytes}");
|
||||||
Logger.Debug($"Memory (Used): {Formatter.BytesToGb(memoryMetrics.Used)}");
|
Logger.Debug($"Memory (Used): {ByteSizeValue.FromKiloBytes(memoryMetrics.Used).MegaBytes}");
|
||||||
Logger.Debug(
|
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}");
|
Logger.Debug($"Min Memory: {minMemory}");
|
||||||
executeCleanup = true;
|
executeCleanup = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user