protoactor-go
protoactor-go copied to clipboard
[Feature] Allow to run StopFuture and PoisonFuture with a custom timeout
The case occurred to me that I needed to shut down all my main actors from the root context. Some of the actors perform state serializations, and synchronization on some remote database. In happens that the stopping of the actor can take more than 10 seconds, which is the default time in StopFuture and PoinsonFuture methods of the root context, thus resulting in a time out. Is there an alternative way I can use to gracefully shut down my actors from the root context ? Or increase this time out ? Adding a duration parameter would create an API break
Have the actor spawn a go routine let the go routine do the work. Instead of waiting for it to finish ? Would that help ?
Thanks I will do that for now. But that forces me to introduce a new synchronization mechanism on top of the actor system, as I have to ensure the goroutine is done before exiting the main process.
@melaurent
You could go into the template and write your own custom logic.. 🤔
This is the logic for the timeout itself, I suppose you could derive stuff from there if you need extra operations 😄
https://github.com/AsynkronIT/protoactor-go/blob/b225d28383f2318e0513dfabd22a3037f9043ffd/protobuf/protoc-gen-gograin/template.go#L131-L144