unkey
unkey copied to clipboard
Figure out how to do parallel db queries correctly without Promise.all
See https://github.com/mattrobenolt/ps-http-sim/issues/7
maybe async.parallel may work without causing error?
What's that? I've never heard of it before?
Async is a utility library it has something called async.parallel More here: https://medium.com/@jomote/a-comprehensive-guide-to-using-async-parallel-in-node-js-df51b1bf81a4
I don't think this solves the underlying issue and also will likely not run in workerd
what is the underlying issue though?
It's explained in the issue I linked above https://github.com/mattrobenolt/ps-http-sim/issues/7
I'm not getting the deeper issue. I'm assuming this has to do with running concurrent queries. If so does the database has concurrent query limit and this is exceeding it?
https://github.com/mattrobenolt/ps-http-sim/issues/7#issuecomment-1894607212
I didn't want to submit a PR since I have no way to test any of this or what unkey is, but:
https://github.com/unkeyed/unkey/blob/main/tools/bootstrap/main.ts#L32-L42
If you change this to use new Client(...)
rather than connect(...)
should work just fine.
You might have to do this to shut up the TypeScript type checker: https://github.com/drizzle-team/drizzle-orm/pull/1801#issuecomment-1894593875 until that PR is merged.
Thanks @mattrobenolt, this is great, I'll check it out!