Skip to content

Commit

Permalink
fix: restore fly scale count's speed up (#3939)
Browse files Browse the repository at this point in the history
This change partially reverts #3876. Our backend can place machines in
different hosts even multiple requests are coming at the same time.
  • Loading branch information
kzys authored Nov 4, 2024
1 parent 37a4189 commit ad1099a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions internal/command/scale/count_machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"github.com/superfly/flyctl/iostreams"
)

const maxConcurrentActions = 5

func runMachinesScaleCount(ctx context.Context, appName string, appConfig *appconfig.Config, expectedGroupCounts groupCounts, maxPerRegion int) error {
io := iostreams.FromContext(ctx)
flapsClient := flapsutil.ClientFromContext(ctx)
Expand Down Expand Up @@ -131,16 +133,6 @@ func runMachinesScaleCount(ctx context.Context, appName string, appConfig *appco
return err
}

// Deleting machines is safe to parallelize,
// but creating machines is not because of how the platform propagetes data.
maxConcurrentActions := 5
_, scaleUp := lo.Find(actions, func(a *planItem) bool {
return a.Delta > 0
})
if scaleUp {
maxConcurrentActions = 1
}

updatePool := pool.New().
WithErrors().
WithMaxGoroutines(maxConcurrentActions).
Expand Down

0 comments on commit ad1099a

Please sign in to comment.