From 56f9ba159b72a303ea388f466fa4e5ed57a6f45b Mon Sep 17 00:00:00 2001 From: Silarn Date: Mon, 28 Jan 2019 00:01:55 -0600 Subject: Detect throttling with error code 429 --- src/nexusinterface.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 760af6a9..080b4f7e 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -553,6 +553,11 @@ void NexusInterface::requestFinished(std::list::iterator iter) if (reply->error() != QNetworkReply::NoError) { qWarning("request failed: %s", reply->errorString().toUtf8().constData()); emit nxmRequestFailed(iter->m_GameName, iter->m_ModID, iter->m_FileID, iter->m_UserData, iter->m_ID, reply->error(), reply->errorString()); + int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if (statusCode == 429) { + m_RemainingRequests = 0; + qWarning() << tr("Requests have hit the rate limit threshold and are now being throttled."); + } } else { int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (statusCode == 301) { -- cgit v1.3.1