forked from p15670423/monkey
Island: Simplify cursor to agents
This commit is contained in:
parent
411b027e92
commit
3b6e4f5313
|
@ -62,7 +62,7 @@ class MongoAgentRepository(IAgentRepository):
|
||||||
def get_running_agents(self) -> Sequence[Agent]:
|
def get_running_agents(self) -> Sequence[Agent]:
|
||||||
try:
|
try:
|
||||||
cursor = self._agents_collection.find({"stop_time": None}, {MONGO_OBJECT_ID_KEY: False})
|
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:
|
except Exception as err:
|
||||||
raise RetrievalError(f"Error retrieving running agents: {err}")
|
raise RetrievalError(f"Error retrieving running agents: {err}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue