AccountList: Skip refresh when !shouldRefresh

Signed-off-by: cat <cat@plan9.rocks>
(cherry picked from commit ea2d0d0644)
This commit is contained in:
cat 2026-05-31 14:26:32 +00:00 committed by github-actions[bot]
parent 5cf7b4629f
commit 779bf1d20c

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);