Skip to content

Commit

Permalink
make async
Browse files Browse the repository at this point in the history
  • Loading branch information
HansKallekleiv committed Oct 23, 2023
1 parent 6609b5f commit b63b179
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/src/services/sumo_access/observation_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ async def get_observations(self) -> Observations:
name="observations",
tagname="all",
)
if len(observations_collection) == 0:
if await observations_collection.length_async() == 0:
return Observations()
if len(observations_collection) > 1:
if await observations_collection.length_async() > 1:
raise ValueError(f"More than one observations dictionary found. {observations_collection.names}")

observations_handle: Dictionary = observations_collection[0]
observations_bytes = observations_handle.blob
observations_dict = json.loads(observations_bytes.decode())
observations_handle: Dictionary = await observations_collection.getitem_async(0)
observations_byteio = await observations_handle.blob_async
observations_dict = json.loads(observations_byteio.getvalue().decode())

return Observations(
summary=_create_summary_observations(observations_dict), rft=_create_rft_observations(observations_dict)
Expand Down

0 comments on commit b63b179

Please sign in to comment.