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
Uds support #3259
Uds support #3259
Conversation
d14c78f
to
7c98bda
Compare
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.
Really nice!
@@ -166,6 +172,12 @@ export class NodeEngine { | |||
) | |||
this.engineEndpoint = engineEndpoint | |||
|
|||
if (useUds && process.platform !== 'win32') { | |||
this.socketPath = `/tmp/prisma-${getRandomString()}.sock` |
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.
What are the chances that the filesystem refuse access to /tmp/
or if it's read only? I guess the socket would not initialize?
Should we check that first maybe like this?
try {
// R_OK | Flag indicating that the file can be read by the calling process.
// W_OK | Flag indicating that the file can be written by the calling process.
fs.accessSync(path.dirname(this.socketPath), fs.constants.R_OK | fs.constants.W_OK)
}
catch (err) {
// err
}
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.
I'm not aware of any case, in which /tmp
is not writable.
I would personally keep it simple for now.
if (!this.useUds) { | ||
env.PORT = String(this.port) | ||
} else { | ||
debug(`port: ${this.port}`) |
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.
Why is the debug only for useUds is truthy?
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.
Oops that's wrong, will fix
Also it looks like test failed in CI |
Yep, that's why I'm setting up a Linux machine right now, because I can't reproduce the failing tests on Mac. |
3b14312
to
bf9a100
Compare
UDS can be enabled with new PrismaClient({ __internal: { useUds: true } }) |
Closes #3092