Skip to content

Commit

Permalink
Hips: try to use caching as much as possible
Browse files Browse the repository at this point in the history
We don't want to send too many requests to the hips servers.  There's
probably more to do in order to make sure we don't make too much access.
  • Loading branch information
guillaumechereau committed Apr 10, 2018
1 parent 9c0cae2 commit e808ade
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/StelHips.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ HipsSurvey::HipsSurvey(const QString& url_, double releaseDate_):
{
// Immediatly download the properties.
QNetworkRequest req = QNetworkRequest(getUrlFor("properties"));
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
QNetworkReply* networkReply = StelApp::getInstance().getNetworkAccessManager()->get(req);
connect(networkReply, &QNetworkReply::finished, [&, networkReply] {
QByteArray data = networkReply->readAll();
Expand Down Expand Up @@ -152,6 +153,7 @@ bool HipsSurvey::getAllsky()
QUrl path = getUrlFor(QString("Norder%1/Allsky.%2").arg(getPropertyInt("hips_order_min", 3)).arg(ext));
qDebug() << "Load allsky" << path;
QNetworkRequest req = QNetworkRequest(path);
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
networkReply = StelApp::getInstance().getNetworkAccessManager()->get(req);
emit statusChanged();

Expand Down

0 comments on commit e808ade

Please sign in to comment.