mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Remove Temporary solution for file restoration issue due to failing to set the data-fingerprint.
Signed-off-by: alex-z <blackslayer4@gmail.com>
This commit is contained in:
parent
a7be4044bc
commit
6cafcc1124
2 changed files with 0 additions and 56 deletions
|
@ -802,55 +802,8 @@ void SyncEngine::slotPropagationFinished(bool success)
|
|||
_anotherSyncNeeded = ImmediateFollowUp;
|
||||
}
|
||||
|
||||
// TODO: Remove this when the file restoration problem is fixed for a user
|
||||
bool shouldStartSyncAgain = false;
|
||||
const auto checkAndOverrideSetDataFingerprint = [this, &shouldStartSyncAgain] {
|
||||
const int dataFingerprintOverrideThreshold = 9;
|
||||
const QString dataFingerprintOverrideHostHash = QStringLiteral("63debc9ef6d217649ea70632ca573a1db7a237ba61c48cdd2bf797f7060233db");
|
||||
const auto accountHost = account()->url().host();
|
||||
const auto accountDisplayName = account()->displayName();
|
||||
|
||||
if (_dataFingerprintSetFailCount >= 0) {
|
||||
qCWarning(lcEngine) << "setDataFingerprint has failed for account" << accountDisplayName << "on host" << accountHost << "due to sync errors. Checking the possibility for override...";
|
||||
|
||||
if (_dataFingerprintSetFailCount > 0) {
|
||||
if (_dataFingerprintSetFailCount >= dataFingerprintOverrideThreshold) {
|
||||
qCWarning(lcEngine) << "All sync attempts failed for account" << accountDisplayName << "on host" << accountHost << "setting the dataFingerprint anyway.";
|
||||
_journal->setDataFingerprint(_discoveryPhase->_dataFingerprint);
|
||||
// this mechanism should only run once per app launch
|
||||
_dataFingerprintSetFailCount = -1;
|
||||
} else {
|
||||
++_dataFingerprintSetFailCount;
|
||||
// request to start sync again as it won't happen by itself unless the file has changed on the server or in the local folder
|
||||
shouldStartSyncAgain = true;
|
||||
}
|
||||
} else {
|
||||
// only compare hash once
|
||||
// if it matches - we don't need to calculate it again while _dataFingerprintSetFailCount is greater than 0
|
||||
const auto accountHostHash = QString::fromUtf8(QCryptographicHash::hash(accountHost.toUtf8(), QCryptographicHash::Sha256).toHex());
|
||||
|
||||
if (accountHostHash == dataFingerprintOverrideHostHash) {
|
||||
qCInfo(lcEngine) << "accountHostHash" << accountHostHash << "equals to dataFingerprintOverrideHostHash" << dataFingerprintOverrideHostHash << "_dataFingerprintSetFailCount" << _dataFingerprintSetFailCount;
|
||||
++_dataFingerprintSetFailCount;
|
||||
// request to start sync again as it won't happen by itself unless the file has changed on the server or in the local folder
|
||||
shouldStartSyncAgain = true;
|
||||
} else {
|
||||
qCInfo(lcEngine) << "accountHostHash" << accountHostHash << "differs from dataFingerprintOverrideHostHash" << dataFingerprintOverrideHostHash;
|
||||
// give up on calculating the has next time, as it's not the host we are looking for
|
||||
_dataFingerprintSetFailCount = -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qCWarning(lcEngine) << "setDataFingerprint was overridden already for account" << accountDisplayName << "on host" << accountHost << "but is failing again! Or, it's not the host that we are looking for.";
|
||||
}
|
||||
};
|
||||
//
|
||||
|
||||
if (success && _discoveryPhase) {
|
||||
_journal->setDataFingerprint(_discoveryPhase->_dataFingerprint);
|
||||
} else if (_discoveryPhase) {
|
||||
// TODO: Remove this when the file restoration problem is fixed for a user
|
||||
checkAndOverrideSetDataFingerprint();
|
||||
}
|
||||
|
||||
conflictRecordMaintenance();
|
||||
|
@ -866,12 +819,6 @@ void SyncEngine::slotPropagationFinished(bool success)
|
|||
emit transmissionProgress(*_progressInfo);
|
||||
|
||||
finalize(success);
|
||||
|
||||
if (shouldStartSyncAgain) {
|
||||
// TODO: Remove this when the file restoration problem is fixed for a user
|
||||
qCWarning(lcEngine) << "Starting sync again for account" << account()->displayName() << "on host" << account()->url().host() << "due to setDataFingerprint override is running.";
|
||||
startSync();
|
||||
}
|
||||
}
|
||||
|
||||
void SyncEngine::finalize(bool success)
|
||||
|
|
|
@ -291,9 +291,6 @@ private:
|
|||
LocalDiscoveryStyle _lastLocalDiscoveryStyle = LocalDiscoveryStyle::FilesystemOnly;
|
||||
LocalDiscoveryStyle _localDiscoveryStyle = LocalDiscoveryStyle::FilesystemOnly;
|
||||
std::set<QString> _localDiscoveryPaths;
|
||||
|
||||
// TODO: Remove this when the file restoration problem is fixed for a user
|
||||
int _dataFingerprintSetFailCount = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue