Open baransu opened 5 years ago
@tcoopman brought up on Discord today that we'd probably want a way of sleeping an actor until it's received a new message. After some discussion, having a Sleep(next_state)
behavior seemed ideal to put the evaluation of an actor on-hold until there are new messages for it to consume.
As a way of tracking this, if your run example one without any changes to the code, you can see the high cpu usage.
Right now we run few infinite loops all the time, even when we don't have any running processes. That makes our CPU to not like us that much as we would like to. To experience that, left any example after all messages have been sent and all tasks have been handled.
I have little experience with Unix processes so I have no idea if it's a good idea to kill workers and respawn them when there is new traffic in the system - I assume it's not. I believe together we can figure something out!