File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- from asyncio import gather , to_thread
1+ from asyncio import gather
22from collections .abc import Iterable , Mapping
33from logging import getLogger
44from pathlib import Path
@@ -144,13 +144,11 @@ async def load_tables(
144144 session .tables .data_transaction (),
145145 ):
146146 await gather (
147- to_thread (
148- session .tables [Skeleton .tables .STATION_INFORMATION .name ].load ,
149- station_information_df ,
147+ session .tables [Skeleton .tables .STATION_INFORMATION .name ].load_async (
148+ station_information_df
150149 ),
151- to_thread (
152- session .tables [Skeleton .tables .STATION_STATUS .name ].load ,
153- station_status_df ,
150+ session .tables [Skeleton .tables .STATION_STATUS .name ].load_async (
151+ station_status_df
154152 ),
155153 )
156154 _LOGGER .info ("Tables loaded." )
Original file line number Diff line number Diff line change @@ -21,4 +21,5 @@ async def read_json(
2121 response = await http_client .get (url )
2222 response .raise_for_status ()
2323 json_bytes = await response .aread ()
24+ # Parse JSON in separate thread to not block the event loop.
2425 return await to_thread (json .loads , json_bytes )
You can’t perform that action at this time.
0 commit comments