Skip to content

Commit ee1058b

Browse files
committed
fix comment and method name
1 parent 46e8086 commit ee1058b

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

services/actions/cleanup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ func CleanupEphemeralRunners(ctx context.Context) error {
155155
return nil
156156
}
157157

158-
// CleanupEphemeralRunnersByRepoID removes all ephemeral runners that have active tasks on the given repository
159-
func CleanupEphemeralRunnersByRepoID(ctx context.Context, repoID int64) error {
158+
// CleanupEphemeralRunnersByPickedTaskRepoID removes all ephemeral runners that have active/finished tasks on the given repository
159+
func CleanupEphemeralRunnersByPickedTaskRepoID(ctx context.Context, repoID int64) error {
160160
subQuery := builder.Select("`action_runner`.id").
161161
From(builder.Select("*").From("`action_runner`"), "`action_runner`"). // mysql needs this redundant subquery
162162
Join("INNER", "`action_task`", "`action_task`.`runner_id` = `action_runner`.`id`").

services/repository/delete.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,11 @@ func DeleteRepositoryDirectly(ctx context.Context, doer *user_model.User, repoID
134134
return err
135135
}
136136

137-
// TODO: Deleting task records could break current ephemeral runner implementation. This is a temporary workaround suggested by ChristopherHX.
138-
// Since you delete potentially the only task an ephemeral act_runner has ever run, please delete the affected runners first.
139-
// one of
140-
// call cleanup ephemeral runners first
141-
// delete affected ephemeral act_runners
142-
// I would make ephemeral runners fully delete directly before formally finishing the task
143-
//
144-
// See also: https://github.com/go-gitea/gitea/pull/34337#issuecomment-2862222788
145-
if err := actions_service.CleanupEphemeralRunnersByRepoID(ctx, repoID); err != nil {
137+
// CleanupEphemeralRunnersByPickedTaskRepoID does delete ephemeral global/org/user that have started any task of this repo
138+
// The cannot pick a second task hardening for ephemeral runners expect that task objects remain available until runner deletion
139+
// This method will delete affected ephemeral global/org/user runners
140+
// &actions_model.ActionRunner{RepoID: repoID} does only handle ephemeral repository runners
141+
if err := actions_service.CleanupEphemeralRunnersByPickedTaskRepoID(ctx, repoID); err != nil {
146142
return fmt.Errorf("cleanupEphemeralRunners: %w", err)
147143
}
148144

0 commit comments

Comments
 (0)