Skip to content

Commit 9120b64

Browse files
committed
use milliseconds for timeouts
1 parent b6b6901 commit 9120b64

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/wrapper.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ export interface SchematicOptions {
3131
logger?: Logger;
3232
/** Enable offline mode to prevent network activity */
3333
offline?: boolean;
34-
/** The default maximum time to wait for a response in seconds */
35-
timeoutInSeconds?: number;
34+
/** The default maximum time to wait for a response in milliseconds */
35+
timeoutMs?: number;
3636
}
3737

3838
export interface CheckFlagOptions {
3939
/** Default value to return on error. Can be a boolean or a function returning a boolean. If not provided, uses configured flag defaults */
4040
defaultValue?: boolean | (() => boolean);
41-
/** The maximum time to wait for a response in seconds */
42-
timeoutInSeconds?: number;
41+
/** The maximum time to wait for a response in milliseconds */
42+
timeoutMs?: number;
4343
}
4444

4545
export class SchematicClient extends BaseClient {
@@ -60,7 +60,7 @@ export class SchematicClient extends BaseClient {
6060
eventBufferInterval,
6161
flagDefaults = {},
6262
logger = new ConsoleLogger(),
63-
timeoutInSeconds,
63+
timeoutMs,
6464
} = opts ?? {};
6565
let { offline = false } = opts ?? {};
6666

@@ -88,7 +88,7 @@ export class SchematicClient extends BaseClient {
8888
apiKey,
8989
environment: basePath,
9090
fetcher: offline ? offlineFetcher : provideFetcher(headers),
91-
timeoutInSeconds,
91+
timeoutInSeconds: timeoutMs !== undefined ? timeoutMs / 1000 : undefined,
9292
});
9393

9494
this.logger = logger;
@@ -134,7 +134,7 @@ export class SchematicClient extends BaseClient {
134134
}
135135

136136
const response = await this.features.checkFlag(key, evalCtx, {
137-
timeoutInSeconds: options?.timeoutInSeconds,
137+
timeoutInSeconds: options?.timeoutMs !== undefined ? options.timeoutMs / 1000 : undefined,
138138
});
139139
if (response.data.value === undefined) {
140140
this.logger.debug(`No value returned from feature flag API for flag ${key}, falling back to default`);

0 commit comments

Comments
 (0)