Skip to content

Commit cb2eaaf

Browse files
committed
:doc: blue_book: idle timeout
1 parent 1ed1d76 commit cb2eaaf

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/patterns/configuration.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,28 @@ new Elysia({
340340
})
341341
```
342342

343+
### Example: Increase timeout
344+
345+
We can increase the idle timeout by setting [`serve.idleTimeout`](#serve-idletimeout) in the `serve` configuration.
346+
347+
```ts
348+
import { Elysia } from 'elysia'
349+
350+
new Elysia({
351+
serve: {
352+
// Increase idle timeout to 30 seconds
353+
idleTimeout: 30
354+
}
355+
})
356+
```
357+
358+
By default the idle timeout is 10 seconds (on Bun).
359+
360+
---
361+
362+
## serve
363+
HTTP server configuration.
364+
343365
Elysia extends Bun configuration which supports TLS out of the box, powered by BoringSSL.
344366

345367
See [serve.tls](#serve-tls) for available configuration.
@@ -354,6 +376,11 @@ Uniquely identify a server instance with an ID
354376

355377
This string will be used to hot reload the server without interrupting pending requests or websockets. If not provided, a value will be generated. To disable hot reloading, set this value to `null`.
356378

379+
### serve.idleTimeout
380+
@default `10` (10 seconds)
381+
382+
By default, Bun set idle timeout to 10 seconds, which means that if a request is not completed within 10 seconds, it will be aborted.
383+
357384
### serve.maxRequestBodySize
358385
@default `1024 * 1024 * 128` (128MB)
359386

0 commit comments

Comments
 (0)