ArchUpdater: fixed CPU hogging

This commit is contained in:
LemmyCook 2025-08-25 13:44:23 -04:00
parent 7a849806fb
commit b19fb316d9
3 changed files with 16 additions and 26 deletions

View file

@ -1,8 +1,9 @@
/*pragma Singleton
pragma Singleton
import Quickshell
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Commons
Singleton {
id: updateService
@ -15,20 +16,23 @@ Singleton {
property int selectedPackagesCount: 0
property bool updateInProgress: false
// Initial check
Component.onCompleted: doPoll()
// Process for checking updates
Process {
id: checkupdatesProcess
command: ["checkupdates"]
onExited: function (exitCode) {
if (exitCode !== 0 && exitCode !== 2) {
console.warn("[UpdateService] checkupdates failed (code:", exitCode, ")")
Logger.warn("ArchUpdater", "checkupdates failed (code:", exitCode, ")")
updatePackages = []
return
}
}
stdout: StdioCollector {
onStreamFinished: {
parseCheckupdatesOutput(text)
Logger.log("ArchUpdater", "found", updatePackages.length, "upgradable package(s)")
}
}
}
@ -150,8 +154,4 @@ Singleton {
running: true
onTriggered: doPoll()
}
// Initial check
Component.onCompleted: doPoll()
}
*/