1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00
denoland-deno/ext/http
Matt Mastracci 950e0e9cd6
fix(ext/http): create a graceful shutdown API (#20387)
This PR implements a graceful shutdown API for Deno.serve, allowing all
current connections to drain from the server before shutting down, while
preventing new connections from being started or new transactions on
existing connections from being created.

We split the cancellation handle into two parts: a listener handle, and
a connection handle. A graceful shutdown cancels the listener only,
while allowing the connections to drain. The connection handle aborts
all futures. If the listener handle is cancelled, we put the connections
into graceful shutdown mode, which disables keep-alive on http/1.1 and
uses http/2 mechanisms for http/2 connections.

In addition, we now guarantee that all connections are complete or
cancelled, and all resources are cleaned up when the server `finished`
promise resolves -- we use a Rust-side server refcount for this.

Performance impact: does not appear to affect basic serving performance
by more than 1% (~126k -> ~125k)

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-12 00:06:38 +00:00
..
benches chore: use rustfmt imports_granularity option (#17421) 2023-01-14 23:18:58 -05:00
00_serve.js fix(ext/http): create a graceful shutdown API (#20387) 2023-09-12 00:06:38 +00:00
01_http.js feat: support import attributes (#20342) 2023-09-07 09:09:16 -04:00
Cargo.toml chore: forward v1.36.4 to main (#20352) 2023-09-01 18:08:58 +00:00
compressible.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
http_next.rs fix(ext/http): create a graceful shutdown API (#20387) 2023-09-12 00:06:38 +00:00
hyper_util_tokioio.rs feat(ext/http): Upgrade to hyper1.0-rc4 (#19987) 2023-07-31 07:34:53 -06:00
lib.rs fix(ext/http): create a graceful shutdown API (#20387) 2023-09-12 00:06:38 +00:00
network_buffered_stream.rs chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
reader_stream.rs chore: update copyright year to 2023 (#17247) 2023-01-02 21:00:42 +00:00
README.md chore: add README to ext/http/ (#11958) 2021-09-08 20:48:28 +02:00
request_body.rs feat(ext/http): Rework Deno.serve using hyper 1.0-rc3 (#18619) 2023-04-22 11:48:21 -06:00
request_properties.rs refactor(ext/http): generic abstract listeners (#19132) 2023-05-15 16:55:47 +02:00
response_body.rs chore: update to Rust 1.72 (#20258) 2023-08-26 22:04:12 -06:00
slab.rs fix(ext/http): create a graceful shutdown API (#20387) 2023-09-12 00:06:38 +00:00
websocket_upgrade.rs chore: update to Rust 1.71 (#19822) 2023-07-13 15:16:24 -06:00

deno_http

This crate implements server-side HTTP based on primitives from the Fetch API.