-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use Prisma's Node-API query engine #6920
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/keystonejs/keystone-next-docs/F6BVBGthRiHc2fwacmf4gHFHnmjf |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
await prisma.$transaction( | ||
Object.values(prisma) | ||
.filter((x: any) => x?.deleteMany) | ||
.map((x: any) => x?.deleteMany?.({})) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing things in transactions also gets around the SQLite write timeout immediately thing so I've done that here
@@ -0,0 +1,67 @@ | |||
import { text } from '@keystone-next/keystone/fields'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests show what previously didn't work on SQLite, they fail (or rather the update and delete ones fail, the create one for some reason does not) on writes-in-parallel-failure
(which is main + this file) for me locally. For some reason they passed on CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: I got these tests to fail on CI on this branch without the limiting: https://github.com/keystonejs/keystone/runs/4205904123?check_suite_focus=true#step:8:17
This reverts commit 7a7ad6a.
LGTM |
Basically this should improve performance when using the Prisma client. See https://www.prisma.io/docs/concepts/components/prisma-engines/query-engine and the section mentioned Node-API on https://github.com/prisma/prisma/releases/tag/3.0.1 for more details. This doesn't look to have an impact on CI performance which is expected since we generally create lots of Prisma clients and do only a couple operations with each of them in tests.
Using this caused some tests to more consistently fail with doing multiple writes on SQLite at the same time so I've made it so we limit writes on SQLite to 1 at a time for a given Prisma client rather than the previous sorta limiting but only if you use *Many operations and not if you do a bunch of single writes, see https://github.com/keystonejs/keystone/pull/6920/files#diff-a6e92b0e6eb325370eba0e5e2be3a8afdb3e866d484db7af462670267dcfc070 for more details.