Replies: 4 comments
-
A feature. 🙂 There are a couple things at play here:
So by scheduling a delayed message. there is at least one reference to the actor until timing out. Then, the actor processes the message. If your system shuts down afterwards, that means that message had the last strong reference to the actor and it terminates because it became unreachable. If that has been the last actor, then the destructor of
Killing the actor manually should give you the desired behavior. There is still a strong reference to it remaining (the scheduled message), but the system is going to shut down regardless if no actors are left running. The actor system should cancel all pending timeouts in this case. |
Beta Was this translation helpful? Give feedback.
-
Is there a way of manually triggering the cancelling of delayed messages ? Might be a handy way of triggering the required behaviour, without manually killing any actors waiting on delayed msgs. |
Beta Was this translation helpful? Give feedback.
-
There's no API for cancelling asynchronous message individually. However, you could cancel all scheduled messages: Be cautious with this. Using it as part of your shutdown should be ok, but cancelling messages of other actors can easily wreak havoc. 😉 |
Beta Was this translation helpful? Give feedback.
-
Ah excellent, that exactly what I was after ! Cheers! |
Beta Was this translation helpful? Give feedback.
-
Not sure if this is a bug or a feature..
In my test bed an actor sends itself a heartbeat every 10 seconds, (to keep a connection alive), unfortunately this stops the actor exiting when the testbed exits.
Not sure how to handle this, I'm guessing the delayed msg in the queue is acting as a reference to the actor, which stops it being able to be garbage collected, or possibly the fact that the queue isn't empty?
Is there any method of making this work ? Do I manually have to kill the actor ? Though I assume it'd still not die until the pending msg is processed.
Any pointers would be very much appreciated
cheer!
Beta Was this translation helpful? Give feedback.
All reactions