Closed Tochemey closed 2 years ago
it prints the panic info.
it prints the panic info.
Ok do the other workers continue processing or what? The info is a bit vague. Also the second part of the question is not answered.
Hey @Tochemey!
I would like to know what happens to the pool when a worker panics
When a worker panics, the configured PanicHandler
is invoked with the panic thrown by the failing task, and the worker continues processing other tasks afterwards (it can recover from panics). The default panic handler is defined here and it simply prints out the panic's full stack trace.
Also what is the best approach to stop the pool when a worker panics.
One way of doing that would be to configure a custom panic handler that can stop the pool when a panic is thrown, something like this:
var pool *pond.WorkerPool
panicHandler := func(panic interface{}) {
// Stop the pool upon receiving a panic
pool.Stop()
}
// Instantiate worker pool with custom panic handler
pool = pond.New(10, 1000, pond.PanicHandler(panicHandler))
Let me know if this is helpful, and thanks for using pond!
Hello,
I would like to know what happens to the pool when a worker panics. Also what is the best approach to stop the pool when a worker panics.
Thanks and congrats for an awesome lib