Open davidisaaclee opened 2 hours ago
I didn't see that the playground uses kysely-sqlite-builder
instead of Kysely directly – not sure what the difference in behavior is, so I'm working to update my example to use Kysely.
Updated snippet to use Kysely directly.
Thanks for reporting and your detailed reproduction. I will look into this issue.
Patch to demonstrate the issue in the playground (updated to use Kysely directly)
```diff diff --git a/playground/src/modules/utils.ts b/playground/src/modules/utils.ts index 8735016..7ddecd2 100644 --- a/playground/src/modules/utils.ts +++ b/playground/src/modules/utils.ts @@ -1,8 +1,27 @@ -import type { Dialect } from 'kysely' +import { Dialect, Kysely } from 'kysely' import type { InferDatabase } from 'kysely-sqlite-builder/schema' import { SqliteBuilder } from 'kysely-sqlite-builder' import { column, defineTable, useSchema } from 'kysely-sqlite-builder/schema' +// helper to manually resolve promises to test concurrency +export function simpleDeferredsimple diagram of tested behavior because reading async code is hard
![Screenshot 2024-11-14 at 4 02 26 PM](https://github.com/user-attachments/assets/efc1eac2-baaa-4f0b-98cf-9ce04d1d2b9b)When a transaction is in-progress, any other requests (outside of the transaction) performed concurrently never resolve.
I have suspicions that also:
kysely-sqlite-builder
if you look at the edit history of this issue)WaSqliteWorkerDriver
– this manifested in my bigger project as anINSERT INTO ... RETURNING
complaining aboutno results
, but when I traced the request / response, the response (1) arrived at the worker driver after the Kysely query execution completed, and (2) did include results – hypothesis is that theno results
error was raised because theINSERT INTO
request thought that some other query response contained the results to its query.I'm going to continue trying to reproduce these issues in the playground, but the issue in the snippet above seems real enough 🤷
I haven't used any of the other packages in this repo, so I don't know if this is an issue in the other drivers.
I'm motivated to fix this for my own project, but I haven't tried fixing it yet – will PR if I'm able to fix it.