Skip to content

Commit

Permalink
add more future.result() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jan 29, 2024
1 parent 1a0e0ab commit 1342c44
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions datasette_upload_csvs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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()

Expand Down

0 comments on commit 1342c44

Please sign in to comment.