Island: Simplify cursor to agents

This commit is contained in:
Mike Salvatore 2022-09-30 10:16:17 -04:00
parent 411b027e92
commit 3b6e4f5313
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ class MongoAgentRepository(IAgentRepository):
def get_running_agents(self) -> Sequence[Agent]:
try:
cursor = self._agents_collection.find({"stop_time": None}, {MONGO_OBJECT_ID_KEY: False})
return list(map(lambda a: Agent(**a), cursor))
return [Agent(**a) for a in cursor]
except Exception as err:
raise RetrievalError(f"Error retrieving running agents: {err}")