From d86d2f704ab0eb91a9051fa818b5195f323467fa Mon Sep 17 00:00:00 2001 From: Silarn Date: Tue, 5 Feb 2019 16:53:54 -0600 Subject: Implement staggered timeouts bases on age. * < 1 mo = 2 hours * < 3 mo = 4 hours * < 6 mo = 6 hours * < 1 yr = 12 hours * > 1 yr = 24 hours --- src/mainwindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cdf363cc..ce476143 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5550,7 +5550,7 @@ void MainWindow::nxmUpdatesAvailable(QString gameName, int modID, QVariant userD requiresInfo = true; } - if (mod->getLastNexusQuery().addDays(1) <= QDateTime::currentDateTime()) + if (mod->getLastNexusQuery().addDays(1) <= QDateTime::currentDateTimeUtc()) requiresInfo = true; } @@ -5577,7 +5577,7 @@ void MainWindow::nxmModInfoAvailable(QString gameName, int modID, QVariant userD std::vector modsList = ModInfo::getByModID(gameNameReal, modID); for (auto mod : modsList) { QDateTime now = QDateTime::currentDateTimeUtc(); - QDateTime updateTarget = mod->getLastNexusUpdate().addSecs(3600); + QDateTime updateTarget = mod->getExpires(); if (now >= updateTarget) { mod->setNewestVersion(result["version"].toString()); mod->setLastNexusUpdate(QDateTime::currentDateTimeUtc()); @@ -5594,6 +5594,7 @@ void MainWindow::nxmModInfoAvailable(QString gameName, int modID, QVariant userD mod->setIsEndorsed(false); } mod->setLastNexusQuery(QDateTime::currentDateTimeUtc()); + mod->setNexusLastModified(QDateTime::fromSecsSinceEpoch(result["updated_timestamp"].toInt())); mod->saveMeta(); } } -- cgit v1.3.1