Skip to content

Commit

Permalink
chore: move schema digest lookup back to before context creation
Browse files Browse the repository at this point in the history
  • Loading branch information
jrriehl committed Sep 7, 2023
1 parent 1f85038 commit 1ae5565
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions python/src/uagents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,12 @@ async def _process_message_queue(self):
# get an element from the queue
schema_digest, sender, message, session = await self._message_queue.get()

# lookup the model definition
model_class: Model = self._models.get(schema_digest)
if model_class is None:
self.logger.warning(f"Received message with unrecognized schema digest: {schema_digest}")
continue

context = Context(
self._identity.address,
self._name,
Expand All @@ -810,12 +816,6 @@ async def _process_message_queue(self):
logger=self._logger,
)

# lookup the model definition
model_class: Model = self._models.get(schema_digest)
if model_class is None:
self.logger.warning(f"Received message with unrecognized schema digest: {schema_digest}")
continue

# parse the received message
try:
recovered = model_class.parse_raw(message)
Expand Down

0 comments on commit 1ae5565

Please sign in to comment.