Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Commit e396721

Browse files
committed
feat: add afterFunc behavior
Useful to catch errors in a infinit worker pool
1 parent 0a8e61e commit e396721

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

workers.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,10 @@ func (r *runner) startWork() {
237237
<-r.limiter
238238
workerWG.Done()
239239
}()
240-
if err := r.workFunc(input, r.outChan); err != nil {
240+
if err := r.afterFunc(r.ctx, r.workFunc(input, r.outChan)); err != nil {
241241
r.once.Do(func() {
242242
r.errChan <- err
243243
r.cancel()
244-
return
245244
})
246245
}
247246
}()

0 commit comments

Comments
 (0)