mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
Merge pull request #4979 from jturcotte/2.2
Memory improvements during propagation
This commit is contained in:
commit
ab24980001
4 changed files with 17 additions and 11 deletions
|
@ -113,6 +113,8 @@ Folder::Folder(const FolderDefinition& definition,
|
|||
|
||||
Folder::~Folder()
|
||||
{
|
||||
// Reset then engine first as it will abort and try to access members of the Folder
|
||||
_engine.reset();
|
||||
}
|
||||
|
||||
void Folder::checkLocalPath()
|
||||
|
|
|
@ -121,17 +121,9 @@ void ProtocolWidget::hideEvent(QHideEvent *ev)
|
|||
|
||||
void ProtocolWidget::cleanItems(const QString& folder)
|
||||
{
|
||||
int itemCnt = _ui->_treeWidget->topLevelItemCount();
|
||||
|
||||
// Limit the number of items
|
||||
while(itemCnt > 2000) {
|
||||
delete _ui->_treeWidget->takeTopLevelItem(itemCnt - 1);
|
||||
itemCnt--;
|
||||
}
|
||||
|
||||
// The issue list is a state, clear it and let the next sync fill it
|
||||
// with ignored files and propagation errors.
|
||||
itemCnt = _issueItemView->topLevelItemCount();
|
||||
int itemCnt = _issueItemView->topLevelItemCount();
|
||||
for( int cnt = itemCnt-1; cnt >=0 ; cnt-- ) {
|
||||
QTreeWidgetItem *item = _issueItemView->topLevelItem(cnt);
|
||||
QString itemFolder = item->data(2, Qt::UserRole).toString();
|
||||
|
@ -239,6 +231,12 @@ void ProtocolWidget::slotItemCompleted(const QString &folder, const SyncFileItem
|
|||
_issueItemView->insertTopLevelItem(0, line);
|
||||
emit issueItemCountUpdated(_issueItemView->topLevelItemCount());
|
||||
} else {
|
||||
// Limit the number of items
|
||||
int itemCnt = _ui->_treeWidget->topLevelItemCount();
|
||||
while(itemCnt > 2000) {
|
||||
delete _ui->_treeWidget->takeTopLevelItem(itemCnt - 1);
|
||||
itemCnt--;
|
||||
}
|
||||
_ui->_treeWidget->insertTopLevelItem(0, line);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,6 +234,8 @@ void PropagateUploadFileQNAM::slotComputeContentChecksum()
|
|||
|
||||
connect(computeChecksum, SIGNAL(done(QByteArray,QByteArray)),
|
||||
SLOT(slotComputeTransmissionChecksum(QByteArray,QByteArray)));
|
||||
connect(computeChecksum, SIGNAL(done(QByteArray,QByteArray)),
|
||||
computeChecksum, SLOT(deleteLater()));
|
||||
computeChecksum->start(filePath);
|
||||
}
|
||||
|
||||
|
@ -268,6 +270,8 @@ void PropagateUploadFileQNAM::slotComputeTransmissionChecksum(const QByteArray&
|
|||
|
||||
connect(computeChecksum, SIGNAL(done(QByteArray,QByteArray)),
|
||||
SLOT(slotStartUpload(QByteArray,QByteArray)));
|
||||
connect(computeChecksum, SIGNAL(done(QByteArray,QByteArray)),
|
||||
computeChecksum, SLOT(deleteLater()));
|
||||
const QString filePath = _propagator->getFilePath(_item->_file);
|
||||
computeChecksum->start(filePath);
|
||||
}
|
||||
|
@ -775,6 +779,8 @@ void PropagateUploadFileQNAM::slotPutFinished()
|
|||
<< _stopWatch.durationOfLap(QLatin1String("ContentChecksum"))
|
||||
<< _stopWatch.durationOfLap(QLatin1String("TransmissionChecksum"))
|
||||
<< _item->_requestDuration;
|
||||
// The job might stay alive for the whole sync, release this tiny bit of memory.
|
||||
_stopWatch.reset();
|
||||
|
||||
finalize(*_item);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
|
@ -121,7 +121,7 @@ namespace Utility
|
|||
|
||||
class OWNCLOUDSYNC_EXPORT StopWatch {
|
||||
private:
|
||||
QHash<QString, quint64> _lapTimes;
|
||||
QMap<QString, quint64> _lapTimes;
|
||||
QDateTime _startTime;
|
||||
QElapsedTimer _timer;
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue