Fix issue where train files would not be deleted past TTL or when over

file number limit.

Test: manual test
Change-Id: Iba6a7f7236cb37dd392ce535ff1875cd31bc9c59
This commit is contained in:
Jonathan Nguyen
2020-02-13 15:44:10 -08:00
parent dfa78d37da
commit 981069af8d

View File

@@ -690,14 +690,16 @@ void StorageManager::trimToFit(const char* path, bool parseTimestampOnly) {
if (name[0] == '.') continue;
FileName output;
string file_name;
if (parseTimestampOnly) {
file_name = StringPrintf("%s/%s", path, name);
output.mTimestampSec = StrToInt64(strtok(name, "_"));
output.mIsHistory = false;
} else {
parseFileName(name, &output);
file_name = output.getFullFileName(path);
}
if (output.mTimestampSec == -1) continue;
string file_name = output.getFullFileName(path);
// Check for timestamp and delete if it's too old.
long fileAge = nowSec - output.mTimestampSec;