diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2021-10-02 15:33:29 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2021-10-02 15:35:06 +0200 |
commit | f34858a90020db73bf39d7351193d351729735c3 (patch) | |
tree | 8aa99387c10d26a384c965d64f7306f7d4f63b68 /kde-frameworks/attica | |
parent | kde-frameworks/knewstuff: Drop 5.86.0-r1 (diff) | |
download | gentoo-f34858a90020db73bf39d7351193d351729735c3.tar.gz gentoo-f34858a90020db73bf39d7351193d351729735c3.tar.bz2 gentoo-f34858a90020db73bf39d7351193d351729735c3.zip |
kde-frameworks/attica: Help upstream lower server utilization
See also:
https://mail.kde.org/pipermail/distributions/2021-October/001054.html
https://invent.kde.org/frameworks/attica/-/merge_requests/15
Package-Manager: Portage-3.0.26, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'kde-frameworks/attica')
-rw-r--r-- | kde-frameworks/attica/attica-5.86.0-r1.ebuild | 28 | ||||
-rw-r--r-- | kde-frameworks/attica/files/attica-5.86.0-fetch-categories.xml-only-once.patch | 68 |
2 files changed, 96 insertions, 0 deletions
diff --git a/kde-frameworks/attica/attica-5.86.0-r1.ebuild b/kde-frameworks/attica/attica-5.86.0-r1.ebuild new file mode 100644 index 000000000000..d920df50fa1f --- /dev/null +++ b/kde-frameworks/attica/attica-5.86.0-r1.ebuild @@ -0,0 +1,28 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +QTMIN=5.15.2 +inherit ecm kde.org + +DESCRIPTION="Framework providing access to Open Collaboration Services" +LICENSE="LGPL-2.1+" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +IUSE="" + +RDEPEND=" + >=dev-qt/qtnetwork-${QTMIN}:5 +" +DEPEND="${RDEPEND}" + +PATCHES=( "${FILESDIR}/${P}-fetch-categories.xml-only-once.patch" ) + +src_test() { + # requires network access, bug #661230 + local myctestargs=( + -E "(providertest)" + ) + + ecm_src_test +} diff --git a/kde-frameworks/attica/files/attica-5.86.0-fetch-categories.xml-only-once.patch b/kde-frameworks/attica/files/attica-5.86.0-fetch-categories.xml-only-once.patch new file mode 100644 index 000000000000..75f7f75b6e91 --- /dev/null +++ b/kde-frameworks/attica/files/attica-5.86.0-fetch-categories.xml-only-once.patch @@ -0,0 +1,68 @@ +commit 7c38c8cf28a4d0d667e23ddfaaf38a955d65bf3e +Author: Aleix Pol <aleixpol@kde.org> +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 <QFile> + #include <QNetworkAccessManager> + #include <QNetworkReply> ++#include <QThreadStorage> + #include <QUrlQuery> + + using namespace Attica; +@@ -1134,8 +1135,18 @@ ListJob<Category> *Provider::requestCategories() + return nullptr; + } + +- QUrl url = createUrl(QLatin1String("content/categories")); +- ListJob<Category> *job = new ListJob<Category>(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<QHash<QUrl, ListJob<Category> *>> reqs; ++ ListJob<Category> *job = reqs.localData().value(url); ++ if (!job) { ++ job = new ListJob<Category>(d->m_internals, createRequest(url)); ++ QObject::connect(job, &BaseJob::finished, [url] { ++ reqs.localData().remove(url); ++ }); ++ reqs.localData().insert(url, job); ++ } + return job; + } + + |