Skip to content

Commit

Permalink
Corrects the libraries panic behaviors
Browse files Browse the repository at this point in the history
This library will no longer swallow panics with this change

Closes GH-5
  • Loading branch information
benjivesterby committed Mar 22, 2022
1 parent 5aa6160 commit 9041cd4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
2 changes: 0 additions & 2 deletions scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func (s Scaler[T, U]) Exec(ctx context.Context, in <-chan T) (<-chan U, error) {
}

go func() {
defer recover()
defer close(out)

wg := sync.WaitGroup{}
Expand Down Expand Up @@ -137,7 +136,6 @@ func (s Scaler[T, U]) layer2(ctx context.Context, in <-chan T) <-chan U {
out := make(chan U)

go func() {
defer recover()
defer close(out)

timer := time.NewTimer(s.Life)
Expand Down
5 changes: 0 additions & 5 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func Intercept[T, U any](
out := make(chan U)

go func() {
defer recover()
defer close(out)

for {
Expand All @@ -59,9 +58,6 @@ func Intercept[T, U any](
// Executing this in a function literal ensures that any panic
// will be caught during execution of the function
func() {
// TODO: Should something happen with this panic data?
defer recover()

// Determine if the function was successful
result, ok := fn(ctx, v)
if !ok {
Expand Down Expand Up @@ -139,7 +135,6 @@ func FanOut[T any](ctx context.Context, in <-chan T, out ...chan<- T) {
// Closure to catch panic on closed channel write.
// Continue Loop
func() {
defer recover()
select {
case <-ctx.Done():
return
Expand Down

0 comments on commit 9041cd4

Please sign in to comment.