Skip to content

Commit

Permalink
Panic if job gets into a state it is not queued but has no runs
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMurkin committed May 4, 2023
1 parent 65bd57e commit dbff26a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ func (s *Scheduler) syncState(ctx context.Context) ([]*jobdb.Job, error) {
}

jobsToUpdate := maps.Values(jobsToUpdateById)

for _, job := range jobsToUpdate {
if !job.Queued() && !job.HasRuns() {
panic(fmt.Sprintf("job %s is not queued but has no runs", job.Id()))
}
}

err = s.jobDb.BatchDelete(txn, jobsToDelete)
if err != nil {
return nil, err
Expand Down

0 comments on commit dbff26a

Please sign in to comment.