mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-02 21:02:09 +00:00
feat: move StopTask, CancelPreviousJobs and CleanRepoScheduleTasks to services/actions
This enables all action run state changes (from a not done to a done state) to also send a notification. Moved these: - models/actions/task.go|423 col 6| func StopTask(ctx context.Context, taskID int64, status Status) error { - models/actions/run.go|190 col 6| func CancelPreviousJobs(ctx context.Context, repoID int64, ref, workflowID string, event webhook_module.HookEventType) error { - models/actions/schedule.go|122 col 6| func CleanRepoScheduleTasks(ctx context.Context, repo *repo_model.Repository, cancelPreviousJobs bool) error {
This commit is contained in:
parent
c977585e4c
commit
81b5c7ca6f
12 changed files with 156 additions and 156 deletions
|
@ -41,7 +41,7 @@ func stopTasks(ctx context.Context, opts actions_model.FindTaskOptions) error {
|
|||
jobs := make([]*actions_model.ActionRunJob, 0, len(tasks))
|
||||
for _, task := range tasks {
|
||||
if err := db.WithTx(ctx, func(ctx context.Context) error {
|
||||
if err := actions_model.StopTask(ctx, task.ID, actions_model.StatusFailure); err != nil {
|
||||
if err := StopTask(ctx, task.ID, actions_model.StatusFailure); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := task.LoadJob(ctx); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue