Commit f8638e85 authored by Fabian Vogt's avatar Fabian Vogt
Browse files

notifier: Don't trigger updates while busy

Previously, checkNewState would trigger an update even if one is currently in
progress, which bypassed the check for the minimum delay.

(cherry picked from commit de330eee)
parent 556ab9b9
Pipeline #137252 passed with stage
in 1 minute and 11 seconds
......@@ -41,12 +41,12 @@ void UnattendedUpdates::checkNewState()
return;
}
const bool hasUpdates = notifier->hasUpdates();
if (hasUpdates && !m_idleTimeoutId.has_value()) {
const bool doTrigger = notifier->hasUpdates() && !notifier->isBusy();
if (doTrigger && !m_idleTimeoutId.has_value()) {
qDebug() << "waiting for an idle moment";
// If the system is untouched for 15 minutes, trigger the unattened update
m_idleTimeoutId = KIdleTime::instance()->addIdleTimeout(int(std::chrono::milliseconds(15min).count()));
} else if (!hasUpdates && m_idleTimeoutId.has_value()) {
} else if (!doTrigger && m_idleTimeoutId.has_value()) {
qDebug() << "nothing to do";
KIdleTime::instance()->removeIdleTimeout(m_idleTimeoutId.value());
m_idleTimeoutId.reset();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment