Skip to content

Commit

Permalink
Check context termination while writting into a channel.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnavarro committed Sep 16, 2022
1 parent 8826fba commit 568a01c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compsequential.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ func getChannelOrErrorSequential[T any](
if !ok {
break f
}
chanOut <- v
select {
case <-ctx.Done():
break f
case chanOut <- v:
}

}
}

Expand Down

0 comments on commit 568a01c

Please sign in to comment.