summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAl <26797547+Al12rs@users.noreply.github.com>2020-06-09 07:34:45 -0700
committerGitHub <noreply@github.com>2020-06-09 07:34:45 -0700
commitda66cb4917c31d574ab3f6c37d21644c1b6bf78f (patch)
tree98a0c8277b43c5cd2ecac9c30b27f5232209a7b1 /src/mainwindow.cpp
parentb548fd37e4da5b5f91638f2a004d918911308f90 (diff)
parenta565472b829c209c6481b61ff5308bf7a76c69bf (diff)
Merge pull request #1118 from Al12rs/nexus_requests_leak
Fix consecutive mod update checks checking some mods again
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 5dcfea1d..9777091a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -5644,9 +5644,10 @@ void MainWindow::nxmModInfoAvailable(QString gameName, int modID, QVariant userD
// with an older version than the main mod version.
if (mod->getNexusFileStatus() != 3 && mod->getNexusFileStatus() != 5) {
mod->setNewestVersion(result["version"].toString());
- mod->setLastNexusUpdate(QDateTime::currentDateTimeUtc());
foundUpdate = true;
}
+ // update the LastNexusUpdate time in any case since we did perform the check.
+ mod->setLastNexusUpdate(QDateTime::currentDateTimeUtc());
}
mod->setNexusDescription(result["description"].toString());
if ((mod->endorsedState() != ModInfo::ENDORSED_NEVER) && (result.contains("endorsement"))) {
@@ -5776,6 +5777,20 @@ void MainWindow::nxmRequestFailed(QString gameName, int modID, int, QVariant, in
{
if (error == QNetworkReply::ContentAccessDenied || error == QNetworkReply::ContentNotFoundError) {
log::debug("{}", tr("Mod ID %1 no longer seems to be available on Nexus.").arg(modID));
+
+ // update last checked timestamp on orphaned mods as well to avoid repeating requests
+ QString gameNameReal;
+ for (IPluginGame* game : m_PluginContainer.plugins<IPluginGame>()) {
+ if (game->gameNexusName() == gameName) {
+ gameNameReal = game->gameShortName();
+ break;
+ }
+ }
+ auto orphanedMods = ModInfo::getByModID(gameNameReal, modID);
+ for (auto mod : orphanedMods) {
+ mod->setLastNexusUpdate(QDateTime::currentDateTimeUtc());
+ mod->setLastNexusQuery(QDateTime::currentDateTimeUtc());
+ }
} else {
MessageDialog::showMessage(tr("Request to Nexus failed: %1").arg(errorString), this);
}