mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
owncloudcmd: Don't do a check that file are older than 2s (#4160)
This is required for the smashbox test to pass
This commit is contained in:
parent
1a59b4e208
commit
0020211857
5 changed files with 18 additions and 14 deletions
|
@ -296,7 +296,7 @@ int main(int argc, char **argv) {
|
|||
if(!options.target_url.endsWith("/")) {
|
||||
options.target_url.append("/");
|
||||
}
|
||||
|
||||
|
||||
if( options.nonShib ) {
|
||||
account->setNonShib(true);
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ int main(int argc, char **argv) {
|
|||
if(!options.davPath.isEmpty()) {
|
||||
account->setDavPath( options.davPath );
|
||||
}
|
||||
|
||||
|
||||
if( !options.target_url.contains( account->davPath() )) {
|
||||
options.target_url.append(account->davPath());
|
||||
}
|
||||
|
@ -379,6 +379,9 @@ int main(int argc, char **argv) {
|
|||
account->setCredentials(cred);
|
||||
account->setSslErrorHandler(sslErrorHandler);
|
||||
|
||||
// much lower age than the default since this utility is usually made to be run right after a change in the tests
|
||||
SyncEngine::minimumFileAgeForUpload = 0;
|
||||
|
||||
int restartCount = 0;
|
||||
restart_sync:
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "accountstate.h"
|
||||
#include "accountmanager.h"
|
||||
#include "filesystem.h"
|
||||
#include <syncengine.h>
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
@ -40,16 +41,6 @@ namespace OCC {
|
|||
|
||||
FolderMan* FolderMan::_instance = 0;
|
||||
|
||||
/**
|
||||
* The minimum time between a sync being requested and it
|
||||
* being executed in milliseconds.
|
||||
*
|
||||
* This delay must be large enough to ensure fileIsStillChanging()
|
||||
* in the upload propagator doesn't decide to skip the file because
|
||||
* the modification was too recent.
|
||||
*/
|
||||
static qint64 msBetweenRequestAndSync = 2000;
|
||||
|
||||
FolderMan::FolderMan(QObject *parent) :
|
||||
QObject(parent),
|
||||
_currentSyncFolder(0),
|
||||
|
@ -652,7 +643,7 @@ void FolderMan::startScheduledSyncSoon(qint64 msMinimumDelay)
|
|||
|
||||
// A minimum of delay here is essential as the sync will not upload
|
||||
// files that were changed too recently.
|
||||
msDelay = qMax(msBetweenRequestAndSync, msDelay);
|
||||
msDelay = qMax(SyncEngine::minimumFileAgeForUpload, msDelay);
|
||||
|
||||
qDebug() << "Scheduling a sync in" << (msDelay/1000) << "seconds";
|
||||
_startScheduledSyncTimer.start(msDelay);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "filesystem.h"
|
||||
#include "propagatorjobs.h"
|
||||
#include "transmissionchecksumvalidator.h"
|
||||
#include "syncengine.h"
|
||||
|
||||
#include <json.h>
|
||||
#include <QNetworkAccessManager>
|
||||
|
@ -53,7 +54,7 @@ static bool fileIsStillChanging(const SyncFileItem & item)
|
|||
const QDateTime modtime = Utility::qDateTimeFromTime_t(item._modtime);
|
||||
const qint64 msSinceMod = modtime.msecsTo(QDateTime::currentDateTime());
|
||||
|
||||
return msSinceMod < 2000
|
||||
return msSinceMod < SyncEngine::minimumFileAgeForUpload
|
||||
// if the mtime is too much in the future we *do* upload the file
|
||||
&& msSinceMod > -10000;
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace OCC {
|
|||
|
||||
bool SyncEngine::_syncRunning = false;
|
||||
|
||||
qint64 SyncEngine::minimumFileAgeForUpload = 2000;
|
||||
|
||||
SyncEngine::SyncEngine(AccountPtr account, CSYNC *ctx, const QString& localPath,
|
||||
const QString& remoteURL, const QString& remotePath, OCC::SyncJournalDb* journal)
|
||||
: _account(account)
|
||||
|
|
|
@ -88,6 +88,13 @@ public:
|
|||
AccountPtr account() const;
|
||||
SyncJournalDb *journal() const { return _journal; }
|
||||
|
||||
/**
|
||||
* Minimum age, in milisecond, of a file that can be uploaded.
|
||||
* Files more recent than that are not going to be uploaeded as they are considered
|
||||
* too young and possibly still changing
|
||||
*/
|
||||
static qint64 minimumFileAgeForUpload; // in ms
|
||||
|
||||
signals:
|
||||
void csyncError( const QString& );
|
||||
void csyncUnavailable();
|
||||
|
|
Loading…
Reference in a new issue