Comments (7)
Thanks for the clarification! I'm really liking this library, it's just so simple but can do everything I want.
from xtra.
In my old code, I kept a context which I used to stop a certain actor, thus triggering the remaining actors in the chain to get dropped. I can't do the same thing with
Mailbox
, since there's no such function. What is the recommended way to solve this problem?
You could also implement your own event loop (see examples), which allows you to not give up ownership of Mailbox
so you can drop it at any time and thus shut down the actor!
from xtra.
I'm in the process of "migrating" code to the new changes that were pushed in recent days. Is it correct that there is currently no stop_all
function on Mailbox
or Address
? I didn't manage to follow what exactly the result of the discussion in #119 was.
In my old code, I kept a context which I used to stop a certain actor, thus triggering the remaining actors in the chain to get dropped. I can't do the same thing with Mailbox
, since there's no such function.
What is the recommended way to solve this problem?
from xtra.
There is still stop_all
, but there is now no more stop
function - you must choose between stop_all
and stop_self
when invokign it. These functions live on Context
.
In my old code, I kept a context which I used to stop a certain actor
I would suggest making a message StopAll
which you send to an address (maybe a weak address?) which causes it to call stop_all
.
from xtra.
Yes, I saw the stop_{all,self}
functions on Context
, but that's not accessible outside of a handler, if I understand correctly.
I would suggest making a message
StopAll
which you send to an address (maybe a weak address?) which causes it to callstop_all
.
In #119 it was mentioned that stop_all
has infinite priority, but for a StopAll
message to be handled it would still have to wait in the queue until it is handled. This isn't a problem for my use case, I just want to clarify that there's no way to bypass the message queue.
from xtra.
No, not from the outside currently. I would recommend just setting the priority to max when you send it
from xtra.
Does this seem appropriate?
/// Stop all actors on this address. This bypasses the message queue, so it will always be
/// handled as soon as possible by all actors, and will not wait for other messages to be
/// enqueued if the queue is full. In other words, it will not wait for an actor which is
/// lagging behind on broadcast messages to catch up before other actors can receive the shutdown
/// message. Therefore, each actor is guaranteed to shut down as its next action immediately
/// after it finishes processing its current message, or as soon as its task is woken if it is
/// currently idle.
///
/// This is similar to calling [`Context::stop_self`] on all actors active on this address, but
/// a broadcast message that would cause [`Context::stop_self`] to be called may have to wait
/// for other broadcast messages, during which time other messages may be handled by actors (i.e
/// the shutdown may be delayed by a lagging actor).
from xtra.
Related Issues (20)
- Way to mark time spent in queue and handler as follows_from request span HOT 4
- Have `Error::Disconnected` contain the actor name HOT 8
- Switch `WaitingSender` implementation to a oneshot channel implementation
- Re-organise cargo workspace
- trait for actors handling multiple message types HOT 4
- Actor with a CPU-bound task HOT 8
- wait for actor to finish processing entire mailbox HOT 10
- Review changelog and sort by priority HOT 2
- `as_either` for `MessageChannel`? HOT 3
- See if we can simplify `TickFuture` HOT 4
- Switch to IntoFuture trait instead of modifying SendFuture
- wasm_bindgen::JsValue within Actor? HOT 4
- Feature Request: relax return type in into sink HOT 2
- Receiver<M> support HOT 7
- Context::notify_later replacement examples HOT 6
- Should we still recommend `spaad` in the README? HOT 3
- Experiment with nightly async fn in traits
- Atomicity of handlers HOT 2
- Actor persistence and journaling HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xtra.