diff -Nru attica-kf5-5.86.0/debian/changelog attica-kf5-5.86.0/debian/changelog --- attica-kf5-5.86.0/debian/changelog 2021-09-13 11:45:48.000000000 +0000 +++ attica-kf5-5.86.0/debian/changelog 2021-10-03 12:17:57.000000000 +0000 @@ -1,8 +1,14 @@ -attica-kf5 (5.86.0-0ubuntu1~ubuntu21.04~ppa1) hirsute; urgency=medium +attica-kf5 (5.86.0-0ubuntu2~ubuntu21.04~ppa1) hirsute; urgency=medium + + * Add upstream-only-fetch-categories-once.patch, as requested by KDE + + -- José Manuel Santamaría Lema Sun, 03 Oct 2021 14:17:57 +0200 + +attica-kf5 (5.86.0-0ubuntu1) impish; urgency=medium * New upstream release (5.86.0) - -- Rik Mills Mon, 13 Sep 2021 12:45:48 +0100 + -- José Manuel Santamaría Lema Mon, 13 Sep 2021 12:45:48 +0100 attica-kf5 (5.85.0-0ubuntu1) impish; urgency=medium diff -Nru attica-kf5-5.86.0/debian/patches/series attica-kf5-5.86.0/debian/patches/series --- attica-kf5-5.86.0/debian/patches/series 2021-09-13 11:45:48.000000000 +0000 +++ attica-kf5-5.86.0/debian/patches/series 2021-10-03 12:17:57.000000000 +0000 @@ -1 +1,2 @@ Disable-network-dependant-test.patch +upstream-only-fetch-categories-once.patch diff -Nru attica-kf5-5.86.0/debian/patches/upstream-only-fetch-categories-once.patch attica-kf5-5.86.0/debian/patches/upstream-only-fetch-categories-once.patch --- attica-kf5-5.86.0/debian/patches/upstream-only-fetch-categories-once.patch 1970-01-01 00:00:00.000000000 +0000 +++ attica-kf5-5.86.0/debian/patches/upstream-only-fetch-categories-once.patch 2021-10-03 12:17:57.000000000 +0000 @@ -0,0 +1,68 @@ +commit 7c38c8cf28a4d0d667e23ddfaaf38a955d65bf3e +Author: Aleix Pol +Date: Wed Sep 22 16:19:39 2021 +0200 + + Ensure categories.xml is only fetched once in parallel + + Otherwise we overload the server that is returning them fairly slowly + anyway (2 to 3 seconds?). It seems like it serves these sequentially as + well, which makes Discover startup stuttery. + +diff --git a/src/atticabasejob.cpp b/src/atticabasejob.cpp +index 99acf4f..e65d556 100644 +--- a/src/atticabasejob.cpp ++++ b/src/atticabasejob.cpp +@@ -26,6 +26,7 @@ public: + PlatformDependent *m_internals; + QNetworkReply *m_reply; + bool aborted{false}; ++ bool started = false; + + Private(PlatformDependent *internals) + : m_internals(internals) +@@ -120,7 +121,10 @@ void BaseJob::dataFinished() + + void BaseJob::start() + { +- QTimer::singleShot(0, this, &BaseJob::doWork); ++ if (!d->started) { ++ d->started = true; ++ QTimer::singleShot(0, this, &BaseJob::doWork); ++ } + } + + void BaseJob::doWork() +diff --git a/src/provider.cpp b/src/provider.cpp +index 9e4da64..b994ce9 100644 +--- a/src/provider.cpp ++++ b/src/provider.cpp +@@ -64,6 +64,7 @@ + #include + #include + #include ++#include + #include + + using namespace Attica; +@@ -1134,8 +1135,18 @@ ListJob *Provider::requestCategories() + return nullptr; + } + +- QUrl url = createUrl(QLatin1String("content/categories")); +- ListJob *job = new ListJob(d->m_internals, createRequest(url)); ++ const QUrl url = createUrl(QLatin1String("content/categories")); ++ ++ // Thread-local cache of categories requests. They are fairly slow and block startup ++ static QThreadStorage *>> reqs; ++ ListJob *job = reqs.localData().value(url); ++ if (!job) { ++ job = new ListJob(d->m_internals, createRequest(url)); ++ QObject::connect(job, &BaseJob::finished, [url] { ++ reqs.localData().remove(url); ++ }); ++ reqs.localData().insert(url, job); ++ } + return job; + } + +