simplify plugin scheduler: remove configurable IdleSleepSeconds, use constant 61s

The SchedulerConfig struct and its persistence/API were unnecessary
indirection. Replace with a simple constant (reduced from 613s to 61s)
so the scheduler re-checks for detectable job types promptly after
going idle, improving the clean-install experience.
This commit is contained in:
Chris Lu
2026-03-09 22:41:03 -07:00
parent 8ad58e7002
commit 1bd7a98a4a
8 changed files with 8 additions and 223 deletions

View File

@@ -64,7 +64,7 @@ func (r *Plugin) schedulerLoop() {
}
r.setSchedulerLoopState("", "sleeping")
idleSleep := r.GetSchedulerConfig().IdleSleepDuration()
idleSleep := defaultSchedulerIdleSleep
if nextRun := r.earliestNextDetectionAt(); !nextRun.IsZero() {
if until := time.Until(nextRun); until <= 0 {
idleSleep = 0
@@ -1134,22 +1134,6 @@ func secondsFromDuration(duration time.Duration) int32 {
return int32(duration / time.Second)
}
func waitForShutdownOrTimer(shutdown <-chan struct{}, duration time.Duration) bool {
if duration <= 0 {
return true
}
timer := time.NewTimer(duration)
defer timer.Stop()
select {
case <-shutdown:
return false
case <-timer.C:
return true
}
}
func waitForShutdownOrTimerWithContext(shutdown <-chan struct{}, ctx context.Context, duration time.Duration) bool {
if duration <= 0 {
return true