mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(ext/websocket): change default idleTimeout to 30s (#23985)
Change the default server websocket `idleTimeout` to 30s to work with common Nginx setups which have a default timeout of 60 seconds
This commit is contained in:
parent
0ef1c774f6
commit
f8975a8ecb
2 changed files with 3 additions and 2 deletions
2
cli/tsc/dts/lib.deno.ns.d.ts
vendored
2
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -5730,7 +5730,7 @@ declare namespace Deno {
|
||||||
* `pong` within the timeout specified, the connection is deemed
|
* `pong` within the timeout specified, the connection is deemed
|
||||||
* unhealthy and is closed. The `close` and `error` event will be emitted.
|
* unhealthy and is closed. The `close` and `error` event will be emitted.
|
||||||
*
|
*
|
||||||
* The unit is seconds, with a default of 120.
|
* The unit is seconds, with a default of 30.
|
||||||
* Set to `0` to disable timeouts. */
|
* Set to `0` to disable timeouts. */
|
||||||
idleTimeout?: number;
|
idleTimeout?: number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,8 @@ function upgradeWebSocket(request, options = { __proto__: null }) {
|
||||||
const socket = createWebSocketBranded(WebSocket);
|
const socket = createWebSocketBranded(WebSocket);
|
||||||
setEventTargetData(socket);
|
setEventTargetData(socket);
|
||||||
socket[_server] = true;
|
socket[_server] = true;
|
||||||
socket[_idleTimeoutDuration] = options.idleTimeout ?? 120;
|
// Nginx timeout is 60s, so default to a lower number: https://github.com/denoland/deno/pull/23985
|
||||||
|
socket[_idleTimeoutDuration] = options.idleTimeout ?? 30;
|
||||||
socket[_idleTimeoutTimeout] = null;
|
socket[_idleTimeoutTimeout] = null;
|
||||||
|
|
||||||
if (inner._wantsUpgrade) {
|
if (inner._wantsUpgrade) {
|
||||||
|
|
Loading…
Reference in a new issue