From bb6825aa4cb48c2766e905817caab72155839f36 Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 25 Oct 2018 18:24:31 +0200 Subject: [PATCH] Use timeout of 0 on first event call --- connector/syncthingconnection.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/connector/syncthingconnection.cpp b/connector/syncthingconnection.cpp index 3a2661c..3606180 100644 --- a/connector/syncthingconnection.cpp +++ b/connector/syncthingconnection.cpp @@ -995,6 +995,10 @@ void SyncthingConnection::requestDiskEvents(int limit) if (m_lastDiskEventId) { query.addQueryItem(QStringLiteral("since"), QString::number(m_lastDiskEventId)); } + // force to return immediately after the first call + if (!m_hasDiskEvents) { + query.addQueryItem(QStringLiteral("timeout"), QStringLiteral("0")); + } QObject::connect( m_diskEventsReply = requestData(QStringLiteral("events/disk"), query), &QNetworkReply::finished, this, &SyncthingConnection::readDiskEvents); } @@ -1036,6 +1040,10 @@ void SyncthingConnection::requestEvents() if (m_lastEventId) { query.addQueryItem(QStringLiteral("since"), QString::number(m_lastEventId)); } + // force to return immediately after the first call + if (!m_hasEvents) { + query.addQueryItem(QStringLiteral("timeout"), QStringLiteral("0")); + } QObject::connect(m_eventsReply = requestData(QStringLiteral("events"), query), &QNetworkReply::finished, this, &SyncthingConnection::readEvents); }