Skip to content

Commit

Permalink
add support for COMPOSE_PARALLEL_LIMIT (parity with Compose v1)
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
  • Loading branch information
ndeloof committed Jan 4, 2023
1 parent b96e27e commit aa5cdf2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"os"
"os/signal"
"path/filepath"
"strconv"
"strings"
"syscall"

Expand Down Expand Up @@ -324,6 +325,13 @@ func RootCommand(streams api.Streams, backend api.Service) *cobra.Command { //no
return err
}
}
if v, ok := os.LookupEnv("COMPOSE_PARALLEL_LIMIT"); ok && !cmd.Flags().Changed("parallel") {
i, err := strconv.Atoi(v)
if err != nil {
return fmt.Errorf("COMPOSE_PARALLEL_LIMIT must be an integer (found: %q)", v)
}
parallel = i
}
if parallel > 0 {
backend.MaxConcurrency(parallel)
}
Expand Down

0 comments on commit aa5cdf2

Please sign in to comment.