Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaas Freitag <kfreitag@owncloud.com>2021-08-16 11:37:56 +0300
committerGitHub <noreply@github.com>2021-08-16 11:37:56 +0300
commita668053c7549e2685b4b5334c5b8e71d07007168 (patch)
tree315d685a3cd3905af30e54ab98e94d55ebdacf20 /src/gui/folderman.cpp
parent49b415b3eff72eedaf30e0e8f945559adc00911f (diff)
Poll interval from capabilities (#8777)
* Add remotePollInterval capability. * Use public const int rather than define for default value. * Honour pollinterval from account capabilities for poll frequency. With this, admins can change the remote poll interval of desktop clients with the capability settings. * Use more efficient invocation of the etag job slot. * Consider capability value to be in milliseconds. * Make format check happy. * Add a ElapsedTimer to measure time since last Etag check. Also, do the check if one of the folders is due to sync every second. That way we get a more accurate sync frequency. The check is very lightweight. * Extend remotePollInterval config method to accept default value. With that it is possible to read the value for the remotepollinterval from the capabilities. * Add changelog entry for #8777. * Changes from clang-format * Fix changelog entry, punctuation at end. * do not go for assumptions how long the request takes. No magic number. * Change some method interfaces to seconds rather than microseconds. Feedback from review. * Again considering more review feedback * Remove additional 5s check already performed in ConfigFile::remotePollInterval Co-authored-by: Hannah von Reth <hannah.vonreth@owncloud.com>
Diffstat (limited to 'src/gui/folderman.cpp')
-rw-r--r--src/gui/folderman.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index 04a2305ca..335091bd6 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -112,10 +112,10 @@ FolderMan::FolderMan(QObject *parent)
_socketApi.reset(new SocketApi);
- ConfigFile cfg;
- std::chrono::milliseconds polltime = cfg.remotePollInterval();
- qCInfo(lcFolderMan) << "setting remote poll timer interval to" << polltime.count() << "msec";
- _etagPollTimer.setInterval(polltime.count());
+ // Set the remote poll interval fixed to 10 seconds.
+ // That does not mean that it polls every 10 seconds, but it checks every 10 secs
+ // if one of the folders is due to sync.
+ _etagPollTimer.setInterval(1000);
QObject::connect(&_etagPollTimer, &QTimer::timeout, this, &FolderMan::slotEtagPollTimerTimeout);
_etagPollTimer.start();
@@ -833,29 +833,19 @@ void FolderMan::slotStartScheduledFolderSync()
void FolderMan::slotEtagPollTimerTimeout()
{
- ConfigFile cfg;
- auto polltime = cfg.remotePollInterval();
-
for (auto *f : qAsConst(_folderMap)) {
if (!f) {
continue;
}
- if (f->isSyncRunning()) {
- continue;
- }
if (_scheduledFolders.contains(f)) {
continue;
}
if (_disabledFolders.contains(f)) {
continue;
}
- if (f->etagJob() || f->isBusy() || !f->canSync()) {
- continue;
- }
- if (f->msecSinceLastSync() < polltime) {
- continue;
+ if (f->dueToSync()) {
+ QMetaObject::invokeMethod(f, &Folder::slotRunEtagJob, Qt::QueuedConnection);
}
- QMetaObject::invokeMethod(f, "slotRunEtagJob", Qt::QueuedConnection);
}
}
@@ -916,7 +906,8 @@ void FolderMan::slotScheduleFolderByTime()
auto msecsSinceSync = f->msecSinceLastSync();
// Possibly it's just time for a new sync run
- bool forceSyncIntervalExpired = msecsSinceSync > ConfigFile().forceSyncInterval();
+ const auto pta = f->accountState()->account()->capabilities().remotePollInterval();
+ bool forceSyncIntervalExpired = msecsSinceSync > ConfigFile().forceSyncInterval(pta);
if (forceSyncIntervalExpired) {
qCInfo(lcFolderMan) << "Scheduling folder" << f->alias()
<< "because it has been" << msecsSinceSync.count() << "ms "