Don't reset last event IDs when connecting again

When connecting again, no data is cleared. Since we now keep
track of event IDs and not just timestamps it makes sense to not
forget what the last event IDs were. To still run into the
"limit" case the flags for having events at all can be used
(which is also reset on just `connect()`).
This commit is contained in:
Martchus 2023-04-15 20:08:21 +02:00
parent 843f164df1
commit d3901cee37
2 changed files with 2 additions and 3 deletions

View File

@ -761,7 +761,6 @@ void SyncthingConnection::continueConnecting()
}
// poll for events
m_lastEventId = m_lastDiskEventId = 0;
requestEvents();
requestDiskEvents();
}

View File

@ -1691,7 +1691,7 @@ void SyncthingConnection::requestEvents()
return;
}
QUrlQuery query;
if (m_lastEventId) {
if (m_lastEventId && m_hasEvents) {
query.addQueryItem(QStringLiteral("since"), QString::number(m_lastEventId));
} else {
query.addQueryItem(QStringLiteral("limit"), QStringLiteral("1"));
@ -2277,7 +2277,7 @@ void SyncthingConnection::requestDiskEvents(int limit)
}
QUrlQuery query;
query.addQueryItem(QStringLiteral("limit"), QString::number(limit));
if (m_lastDiskEventId) {
if (m_lastDiskEventId && m_hasDiskEvents) {
query.addQueryItem(QStringLiteral("since"), QString::number(m_lastDiskEventId));
}
// force to return immediately after the first call