-
-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
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
How can I make ‘Spawn’ return the error that occurred when 'Started' is received? #1105
Comments
I would rather wrap all that in a helper function that handles all of this.
Or if possible, you could do it even before proto.actor is involved at all.
you could create a function that resolves all deps and returns a Props if successful, or err if failed. |
I have considered and tried the first method, but I am unable to determine how long the timeout for synchronous requests should be set. If the time is too long, it may affect the overall performance. |
For the second approach, I might need to do some things using actor.Context during initialization, so it may not work as well. |
Currently, I am not sure if there will be any issues with the way I am doing it. The code is as follows:
|
When I spawn an actor, if I need to initialize the actor upon receiving 'Started', and if initialization fails, the actor should not start successfully. How should I write this code? I noticed that after I receive 'Started', the spawn has already returned the Pid. However, I do not want this because I need the actor to stop when initialization fails and have the spawn return an error
The text was updated successfully, but these errors were encountered: