-
Notifications
You must be signed in to change notification settings - Fork 5
feat: wrapper client setKeepAlive method #339
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
Conversation
@@ -26,6 +26,7 @@ import { HostInfo } from "../../../common/lib/host_info"; | |||
|
|||
export class MySQL2DriverDialect implements DriverDialect { | |||
protected dialectName: string = this.constructor.name; | |||
keepAlivePropertyNames: string[] = []; |
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.
Is there a reason this is not a static constant? can this be modified?
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 the type is string[], not just string?
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.
It's a string[] because there could be multiple properties, for example PG having both keepalive and keepaliveInitialDelayMillis
5fe5632
to
abe26ca
Compare
@@ -52,4 +52,6 @@ export class MySQL2DriverDialect implements DriverDialect { | |||
getAwsPoolClient(props: PoolOptions): AwsPoolClient { | |||
return new AwsMysqlPoolClient(props); | |||
} | |||
|
|||
setupInitialProperties(props: Map<string, any>) {} |
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.
Should we notify user that this feature isn't supported by mysql driver if the user provides tcpKeepAlive configuration?
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've added a note in the UsingTheNodejsWrapper.md file, do you think that's sufficient?
common/lib/aws_client.ts
Outdated
@@ -58,6 +58,8 @@ export abstract class AwsClient extends EventEmitter { | |||
|
|||
this.properties = new Map<string, any>(Object.entries(config)); | |||
|
|||
driverDialect.setupInitialProperties(this.properties); |
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 think it's better to setup these properties in connection provider connect() method.
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.
or in driver dialect connect()
970ac66
to
33b1444
Compare
33b1444
to
0734c4c
Compare
6fc9df1
to
c9b9aa1
Compare
@@ -52,4 +52,6 @@ export class MySQL2DriverDialect implements DriverDialect { | |||
getAwsPoolClient(props: PoolOptions): AwsPoolClient { | |||
return new AwsMysqlPoolClient(props); | |||
} | |||
|
|||
setKeepAliveProperties(props: Map<string, any>, keepAliveProps: any) {} |
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.
Since mysql driver doesn't support tcpKeepAlive I'd suggest to check keepAliveProp and if it set then raise an exception saying that the driver doesn't support it.
Summary
Wrapper client setKeepAlive method
Description
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.