From 7d1d5c8acdcd99162273b4c44ec42dddcea42f8e Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Fri, 7 May 2021 01:35:04 +0800 Subject: [PATCH] Expose SererBuilder::worker_max_blocking_threads (#2200) --- CHANGES.md | 5 +++++ src/server.rs | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 6fe0174a..ead69f29 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,9 +1,14 @@ # Changes ## Unreleased - 2021-xx-xx +### Added +* `HttpServer::worker_max_blocking_threads` for setting block thread pool. [#2200] + ### Changed * Update `language-tags` to `0.3`. +[#2200]: https://github.com/actix/actix-web/pull/2200 + ## 4.0.0-beta.6 - 2021-04-17 ### Added diff --git a/src/server.rs b/src/server.rs index 6e11c642..44ae6f88 100644 --- a/src/server.rs +++ b/src/server.rs @@ -174,6 +174,16 @@ where self } + /// Set max number of threads for each worker's blocking task thread pool. + /// + /// One thread pool is set up **per worker**; not shared across workers. + /// + /// By default set to 512 / workers. + pub fn worker_max_blocking_threads(mut self, num: usize) -> Self { + self.builder = self.builder.worker_max_blocking_threads(num); + self + } + /// Set server keep-alive setting. /// /// By default keep alive is set to a 5 seconds.