mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:58:09 +02:00
Update ES to keep the backup that pushes file size over the limit
This commit is contained in:
parent
11a48915e2
commit
fa22ea7630
1 changed files with 8 additions and 8 deletions
|
@ -40,7 +40,7 @@ constexpr std::chrono::seconds OctreePersistThread::DEFAULT_PERSIST_INTERVAL { 3
|
||||||
constexpr std::chrono::milliseconds TIME_BETWEEN_PROCESSING { 10 };
|
constexpr std::chrono::milliseconds TIME_BETWEEN_PROCESSING { 10 };
|
||||||
|
|
||||||
constexpr int MAX_OCTREE_REPLACEMENT_BACKUP_FILES_COUNT { 20 };
|
constexpr int MAX_OCTREE_REPLACEMENT_BACKUP_FILES_COUNT { 20 };
|
||||||
constexpr size_t MAX_OCTREE_REPLACEMENT_BACKUP_FILES_SIZE_BYTES { 50 * 1000 * 1000 };
|
constexpr int64_t MAX_OCTREE_REPLACEMENT_BACKUP_FILES_SIZE_BYTES { 50 * 1000 * 1000 };
|
||||||
|
|
||||||
OctreePersistThread::OctreePersistThread(OctreePointer tree, const QString& filename, std::chrono::milliseconds persistInterval,
|
OctreePersistThread::OctreePersistThread(OctreePointer tree, const QString& filename, std::chrono::milliseconds persistInterval,
|
||||||
bool debugTimestampNow, QString persistAsFileType) :
|
bool debugTimestampNow, QString persistAsFileType) :
|
||||||
|
@ -269,13 +269,12 @@ void OctreePersistThread::cleanupOldReplacementBackups() {
|
||||||
backupDir.setFilter(QDir::Filter::Files);
|
backupDir.setFilter(QDir::Filter::Files);
|
||||||
qDebug() << "Scanning backups for cleanup:" << backupDir.absolutePath();
|
qDebug() << "Scanning backups for cleanup:" << backupDir.absolutePath();
|
||||||
|
|
||||||
auto count = 0;
|
int count = 0;
|
||||||
size_t totalSize = 0;
|
int64_t totalSize = 0;
|
||||||
for (auto fileInfo : backupDir.entryInfoList()) {
|
for (auto fileInfo : backupDir.entryInfoList()) {
|
||||||
auto absPath = fileInfo.absoluteFilePath();
|
auto absPath = fileInfo.absoluteFilePath();
|
||||||
qDebug() << " Found:" << absPath;
|
qDebug() << " Found:" << absPath;
|
||||||
if (filenameRegex.exactMatch(absPath)) {
|
if (filenameRegex.exactMatch(absPath)) {
|
||||||
totalSize += fileInfo.size();
|
|
||||||
if (count >= MAX_OCTREE_REPLACEMENT_BACKUP_FILES_COUNT || totalSize > MAX_OCTREE_REPLACEMENT_BACKUP_FILES_SIZE_BYTES) {
|
if (count >= MAX_OCTREE_REPLACEMENT_BACKUP_FILES_COUNT || totalSize > MAX_OCTREE_REPLACEMENT_BACKUP_FILES_SIZE_BYTES) {
|
||||||
qDebug() << " Removing:" << absPath;
|
qDebug() << " Removing:" << absPath;
|
||||||
QFile backup(absPath);
|
QFile backup(absPath);
|
||||||
|
@ -285,6 +284,7 @@ void OctreePersistThread::cleanupOldReplacementBackups() {
|
||||||
qWarning() << " Failed to remove backup:" << absPath;
|
qWarning() << " Failed to remove backup:" << absPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
totalSize += fileInfo.size();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue