bytedance / gopkg

Universal Utilities for Go
Apache License 2.0
1.72k stars 226 forks source link

Can 'gopool' support the extended use case of 'errgroup'? #147

Open ryan961 opened 2 years ago

ryan961 commented 2 years ago

Summary

......
// Similar:  group, ctxx := errgroup.WithCancelPool(ctx, pool) 
group, ctxx := errgroup.WithCancel(ctx) 
group.Go(func(ctxx)error)
if err := group.Wait(); err != nil { 
       return;
}
......

Motivation

gopool features (Auto-recovering Panics, Limit Goroutine Numbers, Reuse Goroutine Stack...) can make up for the lack of errgroup very well.

Explanation

No response

PureWhiteWu commented 2 years ago

Hi, there's no plan currently, because this will greatly affect the performance, and gopool and errgroup has different design. If you need these functions, you can use errgroup in these scenes, and use gopool in other scenes.