Skip to content

Commit

Permalink
fix: duplicate job should be an error only after wait period
Browse files Browse the repository at this point in the history
  • Loading branch information
yorugac committed Feb 1, 2024
1 parent 1ddf97c commit b1a5e24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions controllers/k6_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ func createJobSpecs(ctx context.Context, log logr.Logger, k6 v1alpha1.TestRunI,
log.Info(err.Error())

// is it possible to implement this delay with resourceVersion of the job?
t, _ := v1alpha1.LastUpdate(k6, v1alpha1.CloudTestRun)
if time.Since(t).Seconds() <= 30 {
t, condUpdated := v1alpha1.LastUpdate(k6, v1alpha1.CloudTestRun)
// if condition has not been updated yet or has been updated very recently
if !condUpdated || time.Since(t).Seconds() <= 30 {
// try again before returning an error
return ctrl.Result{RequeueAfter: time.Second * 10}, true, nil
}
Expand Down

0 comments on commit b1a5e24

Please sign in to comment.