Cache distro_series so it's not fetched multiple times

main
Simon Quigley 6 days ago
parent ccb0ae0341
commit 4c33732c98

@ -27,6 +27,7 @@ source_package_publishing_history::source_package_publishing_history()
lp(nullptr),
distro_series([this]() -> std::optional<class distro_series> {
if (distro_series_link.empty()) return std::nullopt;
if (_distro_series) return _distro_series;
auto response = lp ? lp->api_get(distro_series_link) : std::nullopt;
if (!response) return std::nullopt;
@ -36,6 +37,7 @@ source_package_publishing_history::source_package_publishing_history()
if (ds) {
ds->set_lp(lp);
_distro_series = ds;
return ds;
}

@ -57,6 +57,7 @@ public:
private:
launchpad* lp;
std::optional<class distro_series> _distro_series = std::nullopt;
};
#endif // SOURCE_PACKAGE_PUBLISHING_HISTORY

Loading…
Cancel
Save