SyncEngine: Save a bit of memory by not keeping a set of all filename

This is only used for conflict files, so only save conflict files.
(The _seenFile was used for other things in 2.5, but not anymore)
This commit is contained in:
Olivier Goffart 2019-10-14 13:19:41 +02:00 committed by Kevin Ottens
parent 83d743b66b
commit 115a53134c
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
2 changed files with 8 additions and 12 deletions

View file

@ -285,9 +285,8 @@ void SyncEngine::conflictRecordMaintenance()
//
// This happens when the conflicts table is new or when conflict files
// are downlaoded but the server doesn't send conflict headers.
for (const auto &path : qAsConst(_seenFiles)) {
if (!Utility::isConflictFile(path))
continue;
for (const auto &path : qAsConst(_seenConflictFiles)) {
ASSERT(Utility::isConflictFile(path));
auto bapath = path.toUtf8();
if (!conflictRecordPaths.contains(bapath)) {
@ -310,11 +309,8 @@ void SyncEngine::conflictRecordMaintenance()
void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
{
_seenFiles.insert(item->_file);
if (!item->_renameTarget.isEmpty()) {
// Yes, this records both the rename renameTarget and the original so we keep both in case of a rename
_seenFiles.insert(item->_renameTarget);
}
if (Utility::isConflictFile(item->_file))
_seenConflictFiles.insert(item->_file);
if (item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA && !item->isDirectory()) {
// For directories, metadata-only updates will be done after all their files are propagated.
@ -441,7 +437,7 @@ void SyncEngine::startSync()
_hasNoneFiles = false;
_hasRemoveFile = false;
_seenFiles.clear();
_seenConflictFiles.clear();
_progressInfo->reset();
@ -881,7 +877,7 @@ void SyncEngine::finalize(bool success)
// Delete the propagator only after emitting the signal.
_propagator.clear();
_seenFiles.clear();
_seenConflictFiles.clear();
_uniqueErrors.clear();
_localDiscoveryPaths.clear();
_localDiscoveryStyle = LocalDiscoveryStyle::FilesystemOnly;

View file

@ -240,8 +240,8 @@ private:
QScopedPointer<DiscoveryPhase> _discoveryPhase;
QSharedPointer<OwncloudPropagator> _propagator;
// List of all files we seen
QSet<QString> _seenFiles;
// List of all files with conflicts
QSet<QString> _seenConflictFiles;
QScopedPointer<ProgressInfo> _progressInfo;