Skip to content

Commit

Permalink
Autoscaler should use queued plan and apply statuses (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
kieranbrown authored Jul 14, 2023
1 parent e21770e commit 7fb7212
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion controllers/agentpool_controller_autoscaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package controllers
import (
"context"
"fmt"
"strings"
"time"

tfc "github.com/hashicorp/go-tfe"
Expand All @@ -19,8 +20,13 @@ import (
)

func getWorkspacePendingRuns(ctx context.Context, ap *agentPoolInstance, workspaceID string) (int, error) {
statuses := []string{
string(tfc.RunPending),
string(tfc.RunPlanQueued),
string(tfc.RunApplyQueued),
}
runs, err := ap.tfClient.Client.Runs.List(ctx, workspaceID, &tfc.RunListOptions{
Status: string(tfc.RunPending),
Status: strings.Join(statuses, ","),
})
if err != nil {
return 0, err
Expand Down

0 comments on commit 7fb7212

Please sign in to comment.