add comment

This commit is contained in:
Shreyas Goenka 2024-10-22 16:34:37 +02:00
parent 5506b975d1
commit f904ea4a92
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 4 additions and 0 deletions

View File

@ -320,6 +320,10 @@ func (r *jobRunner) Cancel(ctx context.Context) error {
func (r *jobRunner) Restart(ctx context.Context, opts *Options) (output.RunOutput, error) { func (r *jobRunner) Restart(ctx context.Context, opts *Options) (output.RunOutput, error) {
// We don't need to cancel existing runs if the job is continuous and unpaused. // We don't need to cancel existing runs if the job is continuous and unpaused.
// the /jobs/run-now API will automatically cancel any existing runs before starting a new one. // the /jobs/run-now API will automatically cancel any existing runs before starting a new one.
//
// /jobs/run-now will not cancel existing runs if the job is continuous and paused.
// New job runs will be queued instead and will wait for existing runs to finish.
// In this case, we need to cancel the existing runs before starting a new one.
continuous := r.job.JobSettings.Continuous continuous := r.job.JobSettings.Continuous
if continuous != nil && continuous.PauseStatus == jobs.PauseStatusUnpaused { if continuous != nil && continuous.PauseStatus == jobs.PauseStatusUnpaused {
return r.Run(ctx, opts) return r.Run(ctx, opts)