Skip to content

Commit 9c87b75

Browse files
committed
Bump conduit-hyper and limit max thread count
If a new request causes the maximum thread count to be exceeded, the request will be rejected with a 503 Service Unavailable response.
1 parent 0e264a2 commit 9c87b75

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ conduit-router = "0.8"
7575
conduit-static = "0.8"
7676
conduit-git-http-backend = "0.8"
7777
civet = "0.9"
78-
conduit-hyper = "0.2.0-alpha.3"
78+
conduit-hyper = "0.2.0-alpha.4"
7979

8080
futures = "0.3"
8181
tokio = { version = "0.2", default-features = false, features = ["net", "signal", "io-std"]}

src/bin/server.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,17 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
6363
println!("Booting with a hyper based server");
6464

6565
let mut rt = tokio::runtime::Builder::new()
66-
//.blocking_threads(threads as usize) // FIXME: Impl this in conduit-hyper
6766
.threaded_scheduler()
6867
.enable_all()
6968
.build()
7069
.unwrap();
7170

72-
let handler = Arc::new(app);
71+
let handler = Arc::new(conduit_hyper::BlockingHandler::new(app, threads as usize));
7372
let make_service =
7473
hyper::service::make_service_fn(move |socket: &hyper::server::conn::AddrStream| {
7574
let addr = socket.remote_addr();
7675
let handler = handler.clone();
77-
async move { Service::from_conduit(handler, addr) }
76+
async move { Service::from_blocking(handler, addr) }
7877
});
7978

8079
let addr = ([127, 0, 0, 1], port).into();

0 commit comments

Comments
 (0)