-
Notifications
You must be signed in to change notification settings - Fork 27
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
message not received by Actor when LocalActorRef::notify is used #7
Comments
I found a solution for my problem using tokio::task::block_in_place and send. But I still think there is something wrong with notify or I don't get how to use it. If someone runs into a similar problem here's my solution:
|
Hi @b-dreissigacker!
If the process exits once the notify has been sent, there's no guarantee that the message will be processed as this will happen in a seperate context. Do you think a |
Here's 3 examples on how notify works: This uses the notify_exec method, which just sends an This sends 5 messages via notify, and then sends another This notifies the actor to |
That's what I expected it to do. A |
Hey @b-dreissigacker, Does your application exit straight after the notify was sent? Since I will add in some blocking APIs in the next release to improve things for use-cases like yours. |
Hey @LeonHartley
|
Hello @uwejan, That looks like a sort of deadlock. The actor is still busy processing the first message, so will be blocked until the handling is complete, the second message is still waiting in the actor's mailbox/channel. You could either use |
@LeonHartley Yes exactky my thoughts.
|
Hi,
I need to send a message to an actor in a non-async function because a struct from an external crate that I use does not implement Send.
From the signature, it looks like I could use LocalActorRef::notify for that and the code compiles with it but the message never reaches the actor.
I cannot share the actual code but it looks something like this:
Do I misunderstand notify?
Is there another blocking way to send messages to Actors?
The text was updated successfully, but these errors were encountered: