tiny-tokio-actor icon indicating copy to clipboard operation
tiny-tokio-actor copied to clipboard

ActorRunner::start handle internal events/SM

Open frehberg opened this issue 2 years ago • 0 comments

ActorRunner::start () only polls for timeout or enqueued messages. So far it cannot poll/support futures being stored inside the Actor, that might drive an internal state-machine.

It would be useful, if the event loop in ActorRunner::start () would poll also for Actor::events, for example:

select! {
 msg =  tokio::time::timeout(timeout, self.receiver.recv()) => { 
       msg.handle(&mut self.actor, &mut ctx).await; 
 },
 // just polling, being handled directly inside, never returns
 _internal_event = self.actor::poll_internal_events() => { /* nothing to do here */ } 
} 

frehberg avatar Jan 27 '23 16:01 frehberg