Search code examples
gogoroutinepanic

how to know when a worker panic in golang ants


I am using ants as my goroutine pool in my program. This library handles panics of workers itself and won't propagate the panic, but I want to catch the panic whenever it occurs in one of my workers.

Is there any way to do this using ants or is there any other library to replace it with?


Solution

  • As I investigated more, I realized that I can define and use my own panic handler. It should be passed to the New function when you are creating an ants pool.