Skip to content

Commit

Permalink
- Added option to set if health checks should be performed (defaults …
Browse files Browse the repository at this point in the history
…to false)
  • Loading branch information
DavidArayan committed Feb 15, 2024
1 parent cec145b commit 3b03f1a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sdk-core/src/core/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export interface ServiceOptions {
// this defaults to 'true'
readonly tls?: boolean | null;

// (optional) perform a health check (only works for NodeJS) using DNS Lookup
// this defaults to `false` as can have speed implications
// health checks are performed once and cached for remainder of the application
readonly healthCheck?: boolean | null;

// (optional) exponential backoff mechanism, retry requests for a number of times
// before failure to alleviate network hiccups or issues. This is defaulted to 3 times
readonly retry?: {
Expand Down Expand Up @@ -113,7 +118,7 @@ export class Service {
// dns health can only be checked on nodejs environments
// default to true for browsers, otherwise will be filled-in by NodeJS
// see .checkHealth() function
this._health = Util.isNode() ? null : { status: true };
this._health = Util.isNode() ? (config.options && config.options.healthCheck ? null : { status: true }) : { status: true };

// set TLS options for NodeJS
if (Util.isNode()) {
Expand Down

0 comments on commit 3b03f1a

Please sign in to comment.