Paste P365

Masterwork From Distant Lands
ActivePublic

Authored by apol on Apr 9 2019, 9:31 PM.
commit 1bde0c619b73979fa01171aaae85262db939e29d
Author: Aleix Pol <aleixpol@kde.org>
Date: Tue Apr 9 23:26:44 2019 +0200
Add debug information when a backend is being slow
This can help us detect what's wrong whenever a backend gets stuck,
which seems to happen every now and then.
diff --git a/libdiscover/resources/AbstractResourcesBackend.cpp b/libdiscover/resources/AbstractResourcesBackend.cpp
index e5d56e20..44dafc15 100644
--- a/libdiscover/resources/AbstractResourcesBackend.cpp
+++ b/libdiscover/resources/AbstractResourcesBackend.cpp
@@ -72,6 +72,18 @@ void ResultsStream::finish()
AbstractResourcesBackend::AbstractResourcesBackend(QObject* parent)
: QObject(parent)
{
+ QTimer* fetchingChangedTimer = new QTimer(this);
+ fetchingChangedTimer->setInterval(3000);
+ fetchingChangedTimer->setSingleShot(true);
+ connect(fetchingChangedTimer, &QTimer::timeout, this, [this]{ qDebug() << "took really long to fetch" << this; });
+
+ connect(this, &AbstractResourcesBackend::fetchingChanged, this, [this, fetchingChangedTimer]{
+// Q_ASSERT(isFetching() != fetchingChangedTimer->isActive());
+ if (isFetching())
+ fetchingChangedTimer->start();
+ else
+ fetchingChangedTimer->stop();
+ });
}
Transaction* AbstractResourcesBackend::installApplication(AbstractResource* app)
apol edited the content of this paste. (Show Details)Apr 9 2019, 9:31 PM
apol changed the title of this paste from untitled to Masterwork From Distant Lands.