-
Notifications
You must be signed in to change notification settings - Fork 35
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
feat: add timeout to options and use it in the reqOpts #455
feat: add timeout to options and use it in the reqOpts #455
Conversation
Codecov Report
@@ Coverage Diff @@
## master #455 +/- ##
==========================================
+ Coverage 98.26% 98.27% +<.01%
==========================================
Files 5 5
Lines 404 405 +1
Branches 99 99
==========================================
+ Hits 397 398 +1
Misses 2 2
Partials 5 5
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #455 +/- ##
==========================================
+ Coverage 98.26% 98.27% +<.01%
==========================================
Files 5 5
Lines 404 405 +1
Branches 99 99
==========================================
+ Hits 397 398 +1
Misses 2 2
Partials 5 5
Continue to review full report at Codecov.
|
@@ -84,6 +85,7 @@ export class Service { | |||
authClient: GoogleAuth; | |||
private getCredentials: {}; | |||
readonly apiEndpoint: string; | |||
timeout: number; |
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.
Wouldn't this be optional? Or are we setting it to a default value?
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 am referencing this below
@@ -69,6 +69,7 @@ export interface ServiceOptions extends GoogleAuthOptions { | |||
promise?: PromiseConstructor; | |||
email?: string; | |||
token?: string; | |||
timeout?: number; // http.request.options.timeout |
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.
@alexander-fenster I'm curious - do we expose a gRPC option for timeout in the GAPIC libraries?
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.
Not directly, but GAPIC libraries can pass any gRPC option by prefixing it with grpc.
and it will be passed all the way down to gRPC.
@@ -103,6 +105,7 @@ export class Service { | |||
constructor(config: ServiceConfig, options: ServiceOptions = {}) { | |||
this.baseUrl = config.baseUrl; | |||
this.apiEndpoint = config.apiEndpoint; | |||
this.timeout = options.timeout!; |
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'd be nervous using the !
here because it looks like it can actually be undefined
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.
add
timeout
toservice
and pass it to reqOpts.With this
timeout
can be exposed to users in the child dependencies (storage, bigquery...)Will apply to googleapis/nodejs-storage/issues/733