diff options
author | Klaas Freitag <kfreitag@owncloud.com> | 2021-08-16 11:37:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-16 11:37:56 +0300 |
commit | a668053c7549e2685b4b5334c5b8e71d07007168 (patch) | |
tree | 315d685a3cd3905af30e54ab98e94d55ebdacf20 /src/gui/folder.h | |
parent | 49b415b3eff72eedaf30e0e8f945559adc00911f (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/folder.h')
-rw-r--r-- | src/gui/folder.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/folder.h b/src/gui/folder.h index 7b3103985..1d687f4d7 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -183,6 +183,12 @@ public: */ bool canSync() const; + /** + * Returns true if the folder needs sync poll interval wise, and can + * sync due to its internal state + */ + bool dueToSync() const; + void prepareToSync(); /** @@ -224,7 +230,7 @@ public: SyncEngine &syncEngine() { return *_engine; } Vfs &vfs() { return *_vfs; } - RequestEtagJob *etagJob() { return _requestEtagJob; } + RequestEtagJob *etagJob() const { return _requestEtagJob; } std::chrono::milliseconds msecSinceLastSync() const { return std::chrono::milliseconds(_timeSinceLastSyncDone.elapsed()); } std::chrono::milliseconds msecLastSyncDuration() const { return _lastSyncDuration; } int consecutiveFollowUpSyncs() const { return _consecutiveFollowUpSyncs; } @@ -307,6 +313,8 @@ signals: public slots: + void slotRunEtagJob(); + /** * terminate the current sync run */ @@ -373,7 +381,6 @@ private slots: void slotTransmissionProgress(const ProgressInfo &pi); void slotItemCompleted(const SyncFileItemPtr &); - void slotRunEtagJob(); void etagRetreived(const QByteArray &, const QDateTime &tp); void etagRetrievedFromSyncEngine(const QByteArray &, const QDateTime &time); @@ -445,6 +452,7 @@ private: QScopedPointer<SyncEngine> _engine; QPointer<RequestEtagJob> _requestEtagJob; QByteArray _lastEtag; + QElapsedTimer _timeSinceLastEtagCheckDone; QElapsedTimer _timeSinceLastSyncDone; QElapsedTimer _timeSinceLastSyncStart; QElapsedTimer _timeSinceLastFullLocalDiscovery; |