Skip to content

Commit 512d89e

Browse files
committed
@GitHK review: async and extra fixes
1 parent 0e6a631 commit 512d89e

File tree

1 file changed

+3
-4
lines changed
  • services/web/server/src/simcore_service_webserver/folders

1 file changed

+3
-4
lines changed

services/web/server/src/simcore_service_webserver/folders/_folders_db.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ async def list_(
150150
list_query = list_query.offset(offset).limit(limit)
151151

152152
async with pass_or_acquire_connection(get_asyncpg_engine(app), connection) as conn:
153-
count_result = await conn.execute(count_query)
154-
total_count = count_result.scalar()
153+
total_count = await conn.scalar(count_query)
155154

156155
result = await conn.stream(list_query)
157156
folders: list[FolderDB] = [FolderDB.from_orm(row) async for row in result]
@@ -259,7 +258,7 @@ async def update(
259258

260259
async with transaction_context(get_asyncpg_engine(app), connection) as conn:
261260
result = await conn.execute(query)
262-
row = await result.first()
261+
row = result.first()
263262
if row is None:
264263
raise FolderNotFoundError(reason=f"Folder {folders_id_or_ids} not found.")
265264
return FolderDB.from_orm(row)
@@ -300,7 +299,7 @@ async def delete_recursively(
300299
final_query = select(folder_hierarchy_cte)
301300
result = await conn.stream(final_query)
302301
# list of tuples [(folder_id, parent_folder_id), ...] ex. [(1, None), (2, 1)]
303-
rows = [row async for row in result.fetchall()]
302+
rows = [row async for row in result]
304303

305304
# Sort folders so that child folders come first
306305
sorted_folders = sorted(

0 commit comments

Comments
 (0)