diff options
-rw-r--r-- | lib/connection.cpp | 13 | ||||
-rw-r--r-- | lib/connection.h | 2 |
2 files changed, 6 insertions, 9 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index 0fb301d1..b702c1f9 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -57,7 +57,6 @@ #include <QtCore/QElapsedTimer> #include <QtCore/QFile> #include <QtCore/QMimeDatabase> -#include <QtCore/QTimer> #include <QtCore/QRegularExpression> #include <QtCore/QStandardPaths> #include <QtCore/QStringBuilder> @@ -518,23 +517,21 @@ void Connection::sync(int timeout) }); } -void Connection::syncLoop(int timeout, int msecBetween) +void Connection::syncLoop(int timeout) { if (d->syncLoopConnection && d->syncTimeout == timeout) { qCInfo(MAIN) << "Attempt to run sync loop but there's one already " "running; nothing will be done"; return; } - std::swap(d->syncTimeout, timeout); // swap() is for the nice log below + std::swap(d->syncTimeout, timeout); if (d->syncLoopConnection) { qCInfo(MAIN) << "Timeout for next syncs changed from" << timeout << "to" << d->syncTimeout; } else { - d->syncLoopConnection = - connect(this, &Connection::syncDone, this, [this, msecBetween] { - QTimer::singleShot(msecBetween, this, - &Connection::syncLoopIteration); - }); + d->syncLoopConnection = connect(this, &Connection::syncDone, + this, &Connection::syncLoopIteration, + Qt::QueuedConnection); syncLoopIteration(); // initial sync to start the loop } } diff --git a/lib/connection.h b/lib/connection.h index 47d1844e..48ea4f5e 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -537,7 +537,7 @@ public slots: void logout(); void sync(int timeout = -1); - void syncLoop(int timeout = -1, int msecBetween = 500); + void syncLoop(int timeout = 30000); void stopSync(); QString nextBatchToken() const; |