-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New concurrency strategy, tested against Datasette pre and post 1.0a7 #36
Conversation
simonw
commented
Jan 24, 2024
•
edited
Loading
edited
- Improved compatibility with Datasette 1.0a+ #37
Weird, it's failing in CI against 1.0+ with this error:
But passes on my laptop. |
Since it's the type conversions that are failing I am suspicious of this code: datasette-upload-csvs/datasette_upload_csvs/__init__.py Lines 166 to 176 in a0b64f7
Why is that |
I want to see all the test failures to spot patterns in what fails.
Weird, still that same test failure where types are not converted on some Python versions for Datasette 1.0. Even weirder: I saw it pass on 3.7, 3.10 and 3.11 with Datasette <1.0 in this run: https://github.com/simonw/datasette-upload-csvs/actions/runs/7658565625 But then when I added Maybe a race condition or something else that's intermittent? |
Tests pass without that weird pause on my laptop against Datasette 1.0ax. |
I'll try running this is Codespaces, see if I can recreate that weird testing bug. |
In Codespaces the tests passed... but then it hung at the end of the test run rather than giving me back the terminal. Hitting Ctrl+C there showed this error:
|
OK, at least the tests fail after a minute now rather than hanging around for hours. |
I'm going to try a different strategy: I'm going to run the CSV parsing in an async task on the main thread, but have it yield that task every 100 items inserted. Let's see if that works better. Backup plan after that: could I run the CSV parsing in a separate thread but have 100 rows at a time passed from that thread back to a task in the main thread which then sends them to the write database? |
OK, that async strategy seems to work pretty well! While uploading a large CSV file the app stayed responsive to other requests. |
Test failures still look like this:
Suggesting a timing issue where the types transform sometimes hasn't completed when the test runs. |
That debug output looks correct to me:
So why isn't that taking effect before the test assertion runs? datasette-upload-csvs/tests/test_datasette_upload_csvs.py Lines 167 to 186 in 233010e
|