mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpilibj] DataLogManager: Fix behavior when low on space (#6486)
Uses getUsableSpace in Java, matching how C++ determines available space (C++ calls it available, but they mean the same thing.) This fixes a bug where logs wouldn't get deleted due to incorrect available space detection. The DataLog thread now also checks if the state was marked as stopped after a call to StartLogFile.
This commit is contained in:
@@ -269,7 +269,7 @@ public final class DataLogManager {
|
||||
// based on free disk space, scan for "old" FRC_*.wpilog files and remove
|
||||
{
|
||||
File logDir = new File(m_logDir);
|
||||
long freeSpace = logDir.getFreeSpace();
|
||||
long freeSpace = logDir.getUsableSpace();
|
||||
if (freeSpace < kFreeSpaceThreshold) {
|
||||
// Delete oldest FRC_*.wpilog files (ignore FRC_TBD_*.wpilog as we just created one)
|
||||
File[] files =
|
||||
@@ -304,7 +304,7 @@ public final class DataLogManager {
|
||||
+ freeSpace / 1000000
|
||||
+ " MB of free space remaining! Logs will get deleted below "
|
||||
+ kFreeSpaceThreshold / 1000000
|
||||
+ " MB of free space."
|
||||
+ " MB of free space. "
|
||||
+ "Consider deleting logs off the storage device.",
|
||||
false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user