From b444c0b98db6dee5a10d680f30ba1c0fbff4f285 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 2 Oct 2023 18:01:59 -0700 Subject: Set `fetch` timeout to 5 minutes (#6217) * Increase timeouts * Update uws.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/bun.js/api/bun/socket.zig | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/bun.js/api') diff --git a/src/bun.js/api/bun/socket.zig b/src/bun.js/api/bun/socket.zig index a8c0948d9..752adea1e 100644 --- a/src/bun.js/api/bun/socket.zig +++ b/src/bun.js/api/bun/socket.zig @@ -771,7 +771,7 @@ pub const Listener = struct { Socket.dataSetCached(this_socket.getThisValue(globalObject), globalObject, default_data); } socket.ext(**anyopaque).?.* = bun.cast(**anyopaque, this_socket); - socket.timeout(120000); + socket.setTimeout(120000); } // pub fn addServerName(this: *Listener, _: *JSC.JSGlobalObject, _: *JSC.CallFrame) callconv(.C) JSValue { @@ -1599,7 +1599,7 @@ fn NewSocket(comptime ssl: bool) type { return .zero; } - this.socket.timeout(@as(c_uint, @intCast(t))); + this.socket.setTimeout(@as(c_uint, @intCast(t))); return JSValue.jsUndefined(); } @@ -2962,6 +2962,17 @@ pub fn NewWrappedHandler(comptime tls: bool) type { } } + pub fn onLongTimeout( + this: WrappedSocket, + socket: Socket, + ) void { + if (comptime tls) { + TLSSocket.onTimeout(this.tls, socket); + } else { + TLSSocket.onTimeout(this.tcp, socket); + } + } + pub fn onConnectError( this: WrappedSocket, socket: Socket, -- cgit v1.2.3