From 1342c44cc7d36f455a9d7b64befd39ca38916b36 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 29 Jan 2024 22:16:21 +0000 Subject: [PATCH] add more future.result() calls --- datasette_upload_csvs/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/datasette_upload_csvs/__init__.py b/datasette_upload_csvs/__init__.py index 25aab7b..b9fcef7 100644 --- a/datasette_upload_csvs/__init__.py +++ b/datasette_upload_csvs/__init__.py @@ -155,9 +155,10 @@ def update_progress(conn): }, ) - asyncio.run_coroutine_threadsafe( + future = asyncio.run_coroutine_threadsafe( db.execute_write_fn(update_progress), event_loop ) + future.result() def write_batch(batch): def insert_batch(conn): @@ -196,9 +197,10 @@ def mark_complete(conn): }, ) - asyncio.run_coroutine_threadsafe( + future = asyncio.run_coroutine_threadsafe( db.execute_write_fn(mark_complete), event_loop ) + future.result() # Transform columns to detected types def transform_columns(conn): @@ -218,9 +220,10 @@ def insert_error(conn): {"error": str(error)}, ) - asyncio.run_coroutine_threadsafe( + future = asyncio.run_coroutine_threadsafe( db.execute_write_fn(insert_error), event_loop ) + future.result() loop = asyncio.get_running_loop()