Skip to content

Commit

Permalink
fix panic: send on closed channel
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Sep 23, 2023
1 parent 8f901ee commit bb5ae43
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmds/mcla_wasm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ func analyzeLogErrorsIter(args []js.Value)(iterator js.Value){
defer close(result)
var wg sync.WaitGroup
resCh, errCh := ScanJavaErrorsIntoChan(r)
LOOP:
for {
select{
case jerr := <-resCh:
if jerr == nil {
return
break LOOP
}
wg.Add(1)
go func(){
Expand All @@ -155,7 +156,7 @@ func analyzeLogErrorsIter(args []js.Value)(iterator js.Value){
}
select {
case result <- res:
case <-bgCtx.Done():
case <-ctx.Done():
}
}()
case err := <-errCh:
Expand Down

0 comments on commit bb5ae43

Please sign in to comment.