mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 06:45:49 +03:00
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:
parent
83d743b66b
commit
115a53134c
2 changed files with 8 additions and 12 deletions
|
@ -285,9 +285,8 @@ void SyncEngine::conflictRecordMaintenance()
|
||||||
//
|
//
|
||||||
// This happens when the conflicts table is new or when conflict files
|
// This happens when the conflicts table is new or when conflict files
|
||||||
// are downlaoded but the server doesn't send conflict headers.
|
// are downlaoded but the server doesn't send conflict headers.
|
||||||
for (const auto &path : qAsConst(_seenFiles)) {
|
for (const auto &path : qAsConst(_seenConflictFiles)) {
|
||||||
if (!Utility::isConflictFile(path))
|
ASSERT(Utility::isConflictFile(path));
|
||||||
continue;
|
|
||||||
|
|
||||||
auto bapath = path.toUtf8();
|
auto bapath = path.toUtf8();
|
||||||
if (!conflictRecordPaths.contains(bapath)) {
|
if (!conflictRecordPaths.contains(bapath)) {
|
||||||
|
@ -310,11 +309,8 @@ void SyncEngine::conflictRecordMaintenance()
|
||||||
|
|
||||||
void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
|
void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
|
||||||
{
|
{
|
||||||
_seenFiles.insert(item->_file);
|
if (Utility::isConflictFile(item->_file))
|
||||||
if (!item->_renameTarget.isEmpty()) {
|
_seenConflictFiles.insert(item->_file);
|
||||||
// Yes, this records both the rename renameTarget and the original so we keep both in case of a rename
|
|
||||||
_seenFiles.insert(item->_renameTarget);
|
|
||||||
}
|
|
||||||
if (item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA && !item->isDirectory()) {
|
if (item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA && !item->isDirectory()) {
|
||||||
// For directories, metadata-only updates will be done after all their files are propagated.
|
// For directories, metadata-only updates will be done after all their files are propagated.
|
||||||
|
|
||||||
|
@ -441,7 +437,7 @@ void SyncEngine::startSync()
|
||||||
|
|
||||||
_hasNoneFiles = false;
|
_hasNoneFiles = false;
|
||||||
_hasRemoveFile = false;
|
_hasRemoveFile = false;
|
||||||
_seenFiles.clear();
|
_seenConflictFiles.clear();
|
||||||
|
|
||||||
_progressInfo->reset();
|
_progressInfo->reset();
|
||||||
|
|
||||||
|
@ -881,7 +877,7 @@ void SyncEngine::finalize(bool success)
|
||||||
|
|
||||||
// Delete the propagator only after emitting the signal.
|
// Delete the propagator only after emitting the signal.
|
||||||
_propagator.clear();
|
_propagator.clear();
|
||||||
_seenFiles.clear();
|
_seenConflictFiles.clear();
|
||||||
_uniqueErrors.clear();
|
_uniqueErrors.clear();
|
||||||
_localDiscoveryPaths.clear();
|
_localDiscoveryPaths.clear();
|
||||||
_localDiscoveryStyle = LocalDiscoveryStyle::FilesystemOnly;
|
_localDiscoveryStyle = LocalDiscoveryStyle::FilesystemOnly;
|
||||||
|
|
|
@ -240,8 +240,8 @@ private:
|
||||||
QScopedPointer<DiscoveryPhase> _discoveryPhase;
|
QScopedPointer<DiscoveryPhase> _discoveryPhase;
|
||||||
QSharedPointer<OwncloudPropagator> _propagator;
|
QSharedPointer<OwncloudPropagator> _propagator;
|
||||||
|
|
||||||
// List of all files we seen
|
// List of all files with conflicts
|
||||||
QSet<QString> _seenFiles;
|
QSet<QString> _seenConflictFiles;
|
||||||
|
|
||||||
QScopedPointer<ProgressInfo> _progressInfo;
|
QScopedPointer<ProgressInfo> _progressInfo;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue