Skip to content

Commit

Permalink
fix semaphore
Browse files Browse the repository at this point in the history
  • Loading branch information
stelzo committed Nov 22, 2024
1 parent 9d9a881 commit 4840c12
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions update.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"os"
"path"
"path/filepath"
"runtime"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -902,17 +901,12 @@ func DownloadUnpackFiles(title string, bin int, manifest *ankabuffer.Manifest, f

var bundleDownloadWg sync.WaitGroup
var bundleDownloadMu sync.Mutex
maxGoroutines := runtime.NumCPU() * 10
sem := make(chan struct{}, maxGoroutines)

for _, bundle := range bundles {
bundleDownloadWg.Add(1)
go func(bundle string) {
defer bundleDownloadWg.Done()

sem <- struct{}{}
defer func() { <-sem }()

bundleData, err := DownloadBundle(bundle)
if err != nil {
log.Errorf("Could not download bundle %s: %s\n", bundle, err)
Expand Down

0 comments on commit 4840c12

Please sign in to comment.