AccountList: Skip refresh when !shouldRefresh (#5614)

This commit is contained in:
Seth Flynn 2026-06-04 03:50:14 +00:00 committed by GitHub
commit ad85dc3291
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -648,9 +648,17 @@ void AccountList::tryNext()
while (m_refreshQueue.length()) {
auto accountId = m_refreshQueue.front();
m_refreshQueue.pop_front();
bool found = false;
for (int i = 0; i < count(); i++) {
auto account = at(i);
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();
if (m_currentTask) {
connect(m_currentTask.get(), &Task::succeeded, this, &AccountList::authSucceeded);
@ -660,9 +668,12 @@ void AccountList::tryNext()
<< accountId;
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.
m_refreshTimer->start(1000 * 3600);