fix(power): reconcile refresh rate after resume (#3459)

This commit is contained in:
Artem Timofeev
2026-10-07 11:17:12 -04:00
committed by GitHub
parent a8146d2ca5
commit 8fedfae1dc
@@ -14,6 +14,8 @@ Singleton {
readonly property int batteryRefreshRateTarget: 60000
readonly property int batteryRefreshRateTolerance: 1000
property int powerSyncRecoveryAttempt: 0
readonly property var powerSyncRecoveryIntervals: [1000, 5000, 15000, 30000]
property var _lastAppliedTargets: ({})
Timer {
@@ -40,6 +42,32 @@ Singleton {
onTriggered: root.requestSync("startup")
}
Timer {
id: powerSyncRecoveryTimer
interval: root.powerSyncRecoveryIntervals[0]
repeat: false
onTriggered: {
root.requestSync("resume-reconcile");
root.powerSyncRecoveryAttempt++;
if (root.powerSyncRecoveryAttempt < root.powerSyncRecoveryIntervals.length) {
interval = root.powerSyncRecoveryIntervals[root.powerSyncRecoveryAttempt];
restart();
return;
}
root.powerSyncRecoveryAttempt = 0;
interval = root.powerSyncRecoveryIntervals[0];
}
}
Connections {
target: SessionService
function onSessionResumed() {
root.powerSyncRecoveryAttempt = 0;
powerSyncRecoveryTimer.interval = root.powerSyncRecoveryIntervals[0];
powerSyncRecoveryTimer.restart();
}
}
Connections {
target: BatteryService
function onIsPluggedInChanged() {