quickshell: speed up k8s refresh while the popout is open
While the popout is open, poll both status and metrics at a fast cadence (kubeRefreshOpenMs, 3s) instead of 2min/15s, and refresh immediately when it opens — so opening the pill shows fresh data and updates live. Status reverts to the slow 2min pill cadence once closed.
This commit is contained in:
@@ -56,8 +56,8 @@ Singleton {
|
||||
// Kubernetes
|
||||
readonly property bool kubeEnabled: true
|
||||
readonly property string kubeNamespace: "tenant-5"
|
||||
readonly property int kubeStatusRefreshMs: 120000
|
||||
readonly property int kubeMetricsRefreshMs: 15000
|
||||
readonly property int kubeStatusRefreshMs: 120000 // pill cadence while popout closed
|
||||
readonly property int kubeRefreshOpenMs: 3000 // fast status+metrics cadence while popout open
|
||||
|
||||
// Idle daemon
|
||||
readonly property string idleProcess: "hypridle"
|
||||
|
||||
@@ -78,21 +78,31 @@ Singleton {
|
||||
onTriggered: root.lastUpdatedSecs++
|
||||
}
|
||||
|
||||
// Status poller
|
||||
// Force an immediate refresh (status always; metrics only while the popout is
|
||||
// open, where they're shown). Called on pill click and on popout open.
|
||||
function refresh() {
|
||||
statusProc.running = false; statusProc.running = true;
|
||||
if (PopoutState.active === "kubernetes") {
|
||||
metricsProc.running = false; metricsProc.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
readonly property bool popoutOpen: PopoutState.active === "kubernetes"
|
||||
onPopoutOpenChanged: if (popoutOpen) refresh()
|
||||
|
||||
// Status poller — slow while the popout is closed (just the pill), fast while open.
|
||||
Timer {
|
||||
interval: Config.kubeStatusRefreshMs
|
||||
interval: root.popoutOpen ? Config.kubeRefreshOpenMs : Config.kubeStatusRefreshMs
|
||||
running: Config.kubeEnabled
|
||||
repeat: true
|
||||
onTriggered: statusProc.running = true
|
||||
}
|
||||
|
||||
// Metrics poller — only while the popout is open (metrics are popout-only).
|
||||
// triggeredOnStart fetches immediately when the popout opens.
|
||||
// Metrics poller — only while the popout is open, at the fast cadence.
|
||||
Timer {
|
||||
interval: Config.kubeMetricsRefreshMs
|
||||
running: Config.kubeEnabled && PopoutState.active === "kubernetes"
|
||||
interval: Config.kubeRefreshOpenMs
|
||||
running: Config.kubeEnabled && root.popoutOpen
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
onTriggered: metricsProc.running = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user