-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
.wait_startup should handle the case of BoxError #74
Comments
This is a great recommendation! So you're only looking to handle any errors that occurred during startup, and no return value for when startup is successful and returns Ok? |
Of course, it would be ideal if a specific
So, if a custom |
This could work, however I'm trying to think how this could be done internally. I guess this means each actor ref would need shared access to a Some implications with this however are:
I do indeed think that having a Eg: async fn on_start(&mut self, _actor_ref: ActorRef<Self>) -> Result<(), BoxError> {
let file = tokio::fs::File::open("...").await?;
self.other_actor_ref.tell(FileOpened(file)).await?;
Ok(())
} |
It would also work to provide two methods, similar to tell and ask: one that does not return a value and one that does. |
Motivation
I would like to propose an enhancement to the .wait_startup method to ensure that, even if it returns a BoxError, it provides better visibility into the actor's internal state and the reason for any failures. This will prevent blocking on wait_startup.await without clear feedback about what went wrong.
Additional Context
An example of the current implementation is as follows:
Or is there a better solution?
The text was updated successfully, but these errors were encountered: