We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg/utils/goroutine.go
Lines 41 to 60 in e3528ea
这里的 GoWithRecover 是不是拆成两个函数比较好,我在使用 errgroup 需要传入裸函数,这样拆分可以使用到 recover 机制,同时是否开启 goroutine 交给用户决定。
func GoWithRecover(handler func(), recoverHandler func(r interface{})) { go func() { WithRecover(handler, recoverHandler) }() } func WithRecover(handler func(), recoverHandler func(r interface{})) { defer func() { if r := recover(); r != nil { recoverLogger(os.Stderr, r) if recoverHandler != nil { go func() { defer func() { if p := recover(); p != nil { recoverLogger(os.Stderr, p) } }() recoverHandler(r) }() } } }() handler() }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
pkg/utils/goroutine.go
Lines 41 to 60 in e3528ea
这里的 GoWithRecover 是不是拆成两个函数比较好,我在使用 errgroup 需要传入裸函数,这样拆分可以使用到 recover 机制,同时是否开启 goroutine 交给用户决定。
The text was updated successfully, but these errors were encountered: