Skip to content

Commit

Permalink
[cron] fixed a race
Browse files Browse the repository at this point in the history
Fixes #107
  • Loading branch information
JanKoehnlein authored and csweichel committed Nov 26, 2021
1 parent 0e49c88 commit 3b61d0a
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions plugins/cron/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ func (*cronPlugin) Run(ctx context.Context, config interface{}, srv v1.WerftServ
})
}

request := &v1.StartGitHubJobRequest{
Metadata: &v1.JobMetadata{
Owner: "cron",
Annotations: annotations,
Trigger: trigger,
Repository: repo,
},
JobPath: task.JobPath,
}
_, err = c.AddFunc(task.Spec, func() {
_, err := srv.StartGitHubJob(ctx, &v1.StartGitHubJobRequest{
Metadata: &v1.JobMetadata{
Owner: "cron",
Annotations: annotations,
Trigger: trigger,
Repository: repo,
},
JobPath: task.JobPath,
})
_, err := srv.StartGitHubJob(ctx, request)
if err != nil {
log.WithError(err).WithField("idx", idx).WithField("spec", task.Spec).Error("cannot start job")
}
Expand Down

0 comments on commit 3b61d0a

Please sign in to comment.