fix(worktime): add fallback heartbeat when query user returns no sessions

This commit is contained in:
igor04091968
2026-05-10 10:59:21 +03:00
parent 4b5c75bdbb
commit 24dd5ae2b4
+10 -2
View File
@@ -209,8 +209,16 @@ while ($true) {
}
if (-not $records -or $records.Count -eq 0) {
Start-Sleep -Seconds $sleepSec
continue
# Fallback sample: keep bucket alive even when query user output is unavailable
# in non-interactive/session-0 contexts.
$records = @(
[pscustomobject]@{
username = [string]$env:USERNAME
sessionName = ''
sessionId = [int](Get-Process -Id $PID).SessionId
state = 'Unknown'
}
)
}
foreach ($rec in $records) {