From 905ec6ef65d4307d09f9aa931790a7ba241ddbcb Mon Sep 17 00:00:00 2001 From: Christopher Homberger Date: Wed, 12 Mar 2025 18:07:10 +0100 Subject: [PATCH] improve sql statement --- services/actions/cleanup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/actions/cleanup.go b/services/actions/cleanup.go index 36259318f5..14416e007f 100644 --- a/services/actions/cleanup.go +++ b/services/actions/cleanup.go @@ -135,7 +135,7 @@ const deleteEphemeralRunnerBatchSize = 100 // CleanupEphemeralRunners removes used ephemeral runners which are no longer able to process jobs func CleanupEphemeralRunners(ctx context.Context) error { runners := []*actions_model.ActionRunner{} - 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) + 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) if err != nil { return fmt.Errorf("find runners: %w", err) }