mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
AccountList: Skip refresh when !shouldRefresh
Signed-off-by: cat <cat@plan9.rocks>
This commit is contained in:
parent
f5d7e76ac4
commit
ea2d0d0644
1 changed files with 12 additions and 1 deletions
|
|
@ -648,9 +648,17 @@ void AccountList::tryNext()
|
||||||
while (m_refreshQueue.length()) {
|
while (m_refreshQueue.length()) {
|
||||||
auto accountId = m_refreshQueue.front();
|
auto accountId = m_refreshQueue.front();
|
||||||
m_refreshQueue.pop_front();
|
m_refreshQueue.pop_front();
|
||||||
|
bool found = false;
|
||||||
for (int i = 0; i < count(); i++) {
|
for (int i = 0; i < count(); i++) {
|
||||||
auto account = at(i);
|
auto account = at(i);
|
||||||
if (account->internalId() == accountId) {
|
if (account->internalId() == accountId) {
|
||||||
|
found = true;
|
||||||
|
if (!account->shouldRefresh()) {
|
||||||
|
// Account no longer needs refreshing, skip it.
|
||||||
|
qDebug() << "RefreshSchedule: Skipping account" << account->profileName() << "with internal ID"
|
||||||
|
<< accountId << "(no longer needs refresh)";
|
||||||
|
break;
|
||||||
|
}
|
||||||
m_currentTask = account->refresh();
|
m_currentTask = account->refresh();
|
||||||
if (m_currentTask) {
|
if (m_currentTask) {
|
||||||
connect(m_currentTask.get(), &Task::succeeded, this, &AccountList::authSucceeded);
|
connect(m_currentTask.get(), &Task::succeeded, this, &AccountList::authSucceeded);
|
||||||
|
|
@ -660,9 +668,12 @@ void AccountList::tryNext()
|
||||||
<< accountId;
|
<< accountId;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug() << "RefreshSchedule: Account with internal ID" << accountId << "not found.";
|
if (!found) {
|
||||||
|
qDebug() << "RefreshSchedule: Account with internal ID" << accountId << "not found.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if we get here, no account needed refreshing. Schedule refresh in an hour.
|
// if we get here, no account needed refreshing. Schedule refresh in an hour.
|
||||||
m_refreshTimer->start(1000 * 3600);
|
m_refreshTimer->start(1000 * 3600);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue