Skip to content

Commit 31261d3

Browse files
authored
fix: serve next run from scheduler state (#2365)
1 parent 2155e3b commit 31261d3

12 files changed

Lines changed: 1673 additions & 1059 deletions

internal/service/frontend/api/v1/dags.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,10 +2056,30 @@ func (a *API) nextRunProjection(ctx context.Context) func(*core.DAG, time.Time)
20562056
}
20572057

20582058
return func(dag *core.DAG, now time.Time) time.Time {
2059+
if schedulerState != nil {
2060+
if nextRun, ok := scheduler.ProjectedNextRun(dag, schedulerState); ok {
2061+
return nextRun
2062+
}
2063+
if hasProfileSchedule(dag) {
2064+
return time.Time{}
2065+
}
2066+
}
20592067
return scheduler.NextPlannedRun(dag, now.In(location), schedulerState)
20602068
}
20612069
}
20622070

2071+
func hasProfileSchedule(dag *core.DAG) bool {
2072+
if dag == nil {
2073+
return false
2074+
}
2075+
for _, schedule := range dag.Schedule {
2076+
if schedule.Profile != "" {
2077+
return true
2078+
}
2079+
}
2080+
return false
2081+
}
2082+
20632083
// parseIntParam parses an integer string, returning defaultVal if parsing fails or value is <= 0.
20642084
func parseIntParam(s string, defaultVal int) int {
20652085
if s == "" {

0 commit comments

Comments
 (0)