Query only one event at the beginning (to find the ID of the latest event)

Syncthing's official web UI also does the first query for events like this.
This should make loading times a bit faster and removes the possibility of
picking-up obsolete events (which was always problematic).
This commit is contained in:
Martchus 2021-07-01 17:37:47 +02:00
parent 6cfa8a96b6
commit fdc73bed60
1 changed files with 2 additions and 0 deletions

View File

@ -1507,6 +1507,8 @@ void SyncthingConnection::requestEvents()
QUrlQuery query;
if (m_lastEventId) {
query.addQueryItem(QStringLiteral("since"), QString::number(m_lastEventId));
} else {
query.addQueryItem(QStringLiteral("limit"), QStringLiteral("1"));
}
// force to return immediately after the first call
if (!m_hasEvents) {