Open eager-seeker opened 5 years ago
Hi. This happens because all agents in the same process share the event loop. So that the order of execution cannot be chosen or have priorities, the coroutines will be executed as fast as possible and (I assume) in order of arrival.
If your application cannot afford this, you can run the agents in separate processes.
Description
Tried to apply basic send/receive comms examples to possible agents for sequential-step toy-game play. The execution of the game steps, and related "inform" behaviour execution, always seemed to take priority over receipt of incoming messages. Incoming messages would not start to be received while the steps were running.
What I Did
Code:
Expected Output
Interleaved sending and receiving:
Actual Output
Delayed receipt.
There seems to be no opportunity for the awaiting routine to get priority till steps are complete. This can be mitigated with a small delay to slow down the rate of
InformBehav
firing (see commented out sleep calls). But without, nothing is received till the steps complete: