Skip to content

Commit

Permalink
test: add concurrent download limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilsol committed Dec 6, 2023
1 parent 8488141 commit 03660fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions cfg/test_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ func SetDefaults() {
viper.SetDefault("dry-run", false)
viper.SetDefault("api-base", "https://api.ficsit.app")
viper.SetDefault("graphql-api", "/v2/query")
viper.SetDefault("concurrent-downloads", 5)
}
2 changes: 2 additions & 0 deletions cli/installations.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@ func (i *Installation) Install(ctx *GlobalContext, updates chan<- InstallUpdate)
}
}

log.Info().Int("concurrency", viper.GetInt("concurrent-downloads")).Str("path", i.Path).Msg("starting installation")

errg := errgroup.Group{}
channelUsers := sync.WaitGroup{}
downloadSemaphore := make(chan int, viper.GetInt("concurrent-downloads"))
Expand Down
6 changes: 6 additions & 0 deletions cli/resolving_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ import (

"github.com/MarvinJWendt/testza"
"github.com/rs/zerolog/log"

"github.com/satisfactorymodding/ficsit-cli/cfg"
)

func init() {
cfg.SetDefaults()
}

func profilesGetResolver() DependencyResolver {
ctx, err := InitCLI(false)
if err != nil {
Expand Down

0 comments on commit 03660fb

Please sign in to comment.