Skip to content

Commit

Permalink
close the channel properly
Browse files Browse the repository at this point in the history
  • Loading branch information
taraspos committed Dec 11, 2024
1 parent 600661a commit 25accc1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/amplify-preview/amplify.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"strings"
"sync"
"time"

"github.com/aws/aws-sdk-go-v2/service/amplify"
Expand Down Expand Up @@ -43,6 +44,8 @@ func (amp *AmplifyPreview) FindExistingBranch(ctx context.Context, branchName st
data *amplify.GetBranchOutput
err error
}
var wg sync.WaitGroup
wg.Add(len(amp.appIDs))
resultCh := make(chan resp, len(amp.appIDs))

for _, appID := range amp.appIDs {
Expand All @@ -56,10 +59,12 @@ func (amp *AmplifyPreview) FindExistingBranch(ctx context.Context, branchName st
data: branch,
err: err,
}

}()
}

wg.Wait()
close(resultCh)

failedResp := aggregatedError{
perAppErr: map[string]error{},
message: "failed to fetch branch",
Expand Down

0 comments on commit 25accc1

Please sign in to comment.