Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,24 @@ func (sch *Scheduler) Run(ctx context.Context) RunStatus {
sch.l.Debug("Checking for @reboot task chains...")
sch.retrieveChainsAndRun(ctx, true)

// Use ticker for strict intervals
ticker := time.NewTicker(refetchTimeout * time.Second)
defer ticker.Stop()
for {
sch.l.Debug("Checking for task chains...")
go sch.retrieveChainsAndRun(ctx, false)
sch.l.Debug("Checking for interval task chains...")
go sch.retrieveIntervalChainsAndRun(ctx)

select {
case <-time.After(refetchTimeout * time.Second):
case <-ticker.C:
// pass
case <-ctx.Done():
sch.status = ContextCancelledStatus
case <-sch.shutdown:
sch.status = ShutdownStatus
sch.terminateChains()
}

if sch.status != RunningStatus {
return sch.status
}
Expand Down
Loading