Skip to content

Commit 28da2b7

Browse files
feat(api): lower default timeout to 5s
1 parent 92e0bc4 commit 28da2b7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 19
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-9f2d347a4bcb03aed092ba4495aac090c3d988e9a99af091ee35c09994adad8b.yml
33
openapi_spec_hash: 73b92bd5503ab6c64dc26da31cca36e2
4-
config_hash: 65328ff206b8c0168c915914506d9dba
4+
config_hash: aafe2b8c43d82d9838c8b77cdd59189f

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } }, {
149149

150150
### Timeouts
151151

152-
Requests time out after 1 minute by default. You can configure this with a `timeout` option:
152+
Requests time out after 5 seconds by default. You can configure this with a `timeout` option:
153153

154154
<!-- prettier-ignore -->
155155
```ts
156156
// Configure the default for all requests:
157157
const client = new Kernel({
158-
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
158+
timeout: 20 * 1000, // 20 seconds (default is 5 seconds)
159159
});
160160

161161
// Override per-request:

src/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class Kernel {
175175
* @param {string | undefined} [opts.apiKey=process.env['KERNEL_API_KEY'] ?? undefined]
176176
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
177177
* @param {string} [opts.baseURL=process.env['KERNEL_BASE_URL'] ?? https://api.onkernel.com/] - Override the default base URL for the API.
178-
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
178+
* @param {number} [opts.timeout=5 seconds] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
179179
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
180180
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
181181
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
@@ -207,7 +207,7 @@ export class Kernel {
207207
}
208208

209209
this.baseURL = options.baseURL || environments[options.environment || 'production'];
210-
this.timeout = options.timeout ?? Kernel.DEFAULT_TIMEOUT /* 1 minute */;
210+
this.timeout = options.timeout ?? Kernel.DEFAULT_TIMEOUT /* 5 seconds */;
211211
this.logger = options.logger ?? console;
212212
const defaultLogLevel = 'warn';
213213
// Set default logLevel early so that we can log a warning in parseLogLevel.
@@ -761,7 +761,7 @@ export class Kernel {
761761
}
762762

763763
static Kernel = this;
764-
static DEFAULT_TIMEOUT = 60000; // 1 minute
764+
static DEFAULT_TIMEOUT = 5000; // 5 seconds
765765

766766
static KernelError = Errors.KernelError;
767767
static APIError = Errors.APIError;

0 commit comments

Comments
 (0)