Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve poll-interval comments #9465

Merged
merged 4 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <QSet>
#include <QNetworkProxy>

using namespace std::chrono_literals;

namespace {
/*
* [Accounts]
Expand Down Expand Up @@ -146,9 +148,11 @@ FolderMan::FolderMan(QObject *parent)
_socketApi.reset(new SocketApi);

// 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);
// That does not mean that it polls every 10 seconds, but it checks every 10 seconds
// if one of the folders is due to sync. This means that if the server advertises a
// pollinterval that is not a multiple of 10 seconds, then that pollinterval will be
// rounded up to the next 10 seconds in practice. 10-second granularity is acceptable.
_etagPollTimer.setInterval(10s);
QObject::connect(&_etagPollTimer, &QTimer::timeout, this, &FolderMan::slotEtagPollTimerTimeout);
_etagPollTimer.start();

Expand Down
8 changes: 5 additions & 3 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const QString moveToTrashC() { return QStringLiteral("moveToTrash"); }
}

QString ConfigFile::_confDir = QString();
const std::chrono::seconds DefaultRemotePollInterval { 30 }; // default remote poll time in milliseconds
const std::chrono::seconds DefaultRemotePollInterval { 30 };

static chrono::milliseconds millisecondsValue(const QSettings &setting, const QString &key,
chrono::milliseconds defaultValue)
Expand Down Expand Up @@ -418,9 +418,11 @@ chrono::milliseconds ConfigFile::remotePollInterval(std::chrono::seconds default

auto defaultPollInterval { DefaultRemotePollInterval };

// The server default-capabilities is set to 60, which is, if interpreted in milliseconds,
// pretty small. If the value is above 5 seconds, it was set intentionally.
// The server default-capabilities was set to 60 in some server releases,
// which, if interpreted in milliseconds, is pretty small.
// If the value is above 5 seconds, it was set intentionally.
// Server admins have to set the value in Milliseconds!
// i.e. set to greater than 5000 milliseconds on the server to be effective.
if (defaultVal > chrono::seconds(5)) {
defaultPollInterval = defaultVal;
}
Expand Down