Skip to content

Commit cd21d33

Browse files
committed
remove async.to_thread to secure the order of execution
1 parent 825038e commit cd21d33

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

synapseclient/models/services/migration.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,9 +1499,7 @@ async def _execute_migration_async(
14991499
pending_keys.add(key)
15001500

15011501
# Check for existing copy — run in a thread to avoid blocking the event loop.
1502-
to_file_handle_id = await asyncio.to_thread(
1503-
_check_file_handle_exists, cursor, from_file_handle_id
1504-
)
1502+
to_file_handle_id = _check_file_handle_exists(cursor, from_file_handle_id)
15051503

15061504
if not to_file_handle_id:
15071505
pending_file_handles.add(from_file_handle_id)
@@ -1512,9 +1510,7 @@ async def _execute_migration_async(
15121510
and create_table_snapshots
15131511
and last_key.id != key.id
15141512
):
1515-
await asyncio.to_thread(
1516-
Table(id=key.id).snapshot_async, synapse_client=synapse_client
1517-
)
1513+
await Table(id=key.id).snapshot_async(synapse_client=synapse_client)
15181514

15191515
# Create migration task
15201516
task = asyncio.create_task(

0 commit comments

Comments
 (0)