From: Kevin Ottens Date: Tue, 20 Oct 2020 15:05:57 +0000 (+0200) Subject: Don't use depth infinity anymore to get the folders e2ee status X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~99^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=10cb4170c7354c919a415f1082cf7bb0618ef988;p=nextcloud-desktop.git Don't use depth infinity anymore to get the folders e2ee status This way we avoid the expensive SQL query on the server at the price of more round-trips since we're doing the recursive traversal by hand now. Also it turns out this depth was used for all the other propfind calls during sync when we want fresher information regarding a folder. This was very inefficient in all cases and won't happen anymore. Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index 340416a89..134a83425 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -1274,8 +1274,17 @@ void ClientSideEncryption::folderEncryptedStatusFetched(const QHashfolder()) { + continue; + } + scheduleFolderEncryptedStatusJob(folder); + } + + if (_folderStatusJobs.isEmpty()) { + _refreshingEncryptionStatus = false; + emit folderEncryptedStatusFetchDone(_folder2encryptedStatus); + } } void ClientSideEncryption::folderEncryptedStatusError(int error) @@ -1287,8 +1296,10 @@ void ClientSideEncryption::folderEncryptedStatusError(int error) _folderStatusJobs.removeAll(job); - _refreshingEncryptionStatus = false; - emit folderEncryptedStatusFetchDone(_folder2encryptedStatus); + if (_folderStatusJobs.isEmpty()) { + _refreshingEncryptionStatus = false; + emit folderEncryptedStatusFetchDone(_folder2encryptedStatus); + } } FolderMetadata::FolderMetadata(AccountPtr account, const QByteArray& metadata, int statusCode) : _account(account) diff --git a/src/libsync/clientsideencryptionjobs.cpp b/src/libsync/clientsideencryptionjobs.cpp index f772fc879..505bd99f5 100644 --- a/src/libsync/clientsideencryptionjobs.cpp +++ b/src/libsync/clientsideencryptionjobs.cpp @@ -40,7 +40,7 @@ void GetFolderEncryptStatusJob::start() req.setPriority(QNetworkRequest::HighPriority); req.setRawHeader("OCS-APIREQUEST", "true"); req.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/xml")); - req.setRawHeader("Depth", "infinity"); + req.setRawHeader("Depth", "1"); QByteArray xml = R"( )"; auto *buf = new QBuffer(this);