1
0
mirror of https://github.com/gsi-upm/soil synced 2024-11-22 03:02:28 +00:00

Fix bug EventedEnvironment

This commit is contained in:
J. Fernando Sánchez 2022-10-20 12:07:56 +02:00
parent 2f5e5d0a74
commit cbbaf73538

View File

@ -318,7 +318,9 @@ class EventedEnvironment(Environment):
for agent in self.agents(**kwargs):
self.logger.info(f'Telling {repr(agent)}: {msg} ttl={ttl}')
try:
agent._inbox.append(events.Tell(payload=msg, sender=sender, expiration=expiration if ttl is None else self.now+ttl))
inbox = agent._inbox
except AttributeError:
self.info(f'Agent {agent.unique_id} cannot receive events')
self.logger.info(f'Agent {agent.unique_id} cannot receive events because it does not have an inbox')
continue
inbox.append(events.Tell(payload=msg, sender=sender, expiration=expiration if ttl is None else self.now+ttl))