Skip to content

Commit 905ec6e

Browse files
committed
improve sql statement
1 parent 8e2085a commit 905ec6e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/actions/cleanup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const deleteEphemeralRunnerBatchSize = 100
135135
// CleanupEphemeralRunners removes used ephemeral runners which are no longer able to process jobs
136136
func CleanupEphemeralRunners(ctx context.Context) error {
137137
runners := []*actions_model.ActionRunner{}
138-
err := db.GetEngine(ctx).Join("INNER", "`action_task`", "`action_task`.`runner_id` = `action_runner`.`id`").Where("`action_runner`.`ephemeral` and `action_task`.`status` != ? and `action_task`.`status` != ? and `action_task`.`status` != ?)", actions_model.StatusWaiting, actions_model.StatusRunning, actions_model.StatusBlocked).Limit(deleteEphemeralRunnerBatchSize).Find(&runners)
138+
err := db.GetEngine(ctx).Join("INNER", "`action_task`", "`action_task`.`runner_id` = `action_runner`.`id`").Where("`action_runner`.`ephemeral` = ? and `action_task`.`status` NOT IN (?, ?, ?)", true, actions_model.StatusWaiting, actions_model.StatusRunning, actions_model.StatusBlocked).Limit(deleteEphemeralRunnerBatchSize).Find(&runners)
139139
if err != nil {
140140
return fmt.Errorf("find runners: %w", err)
141141
}

0 commit comments

Comments
 (0)