Changed threadpool to rusty_pool for a dynamic thread pool
This commit is contained in:
@ -7,7 +7,7 @@ edition = "2018"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
threadpool = "1.0"
|
||||
rusty_pool = "0.6.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0.64"
|
||||
openssl = {version = "0.10", features = ["vendored"]}
|
||||
|
@ -4,7 +4,8 @@ use std::sync::Mutex;
|
||||
use std::thread;
|
||||
|
||||
use openssl::ssl::{SslAcceptor, SslFiletype, SslMethod};
|
||||
use threadpool::ThreadPool;
|
||||
use rusty_pool;
|
||||
use std::time::Duration;
|
||||
|
||||
mod database;
|
||||
mod http;
|
||||
@ -42,7 +43,11 @@ fn main() {
|
||||
|
||||
database::init();
|
||||
|
||||
let thread_pool = ThreadPool::new(256);
|
||||
let thread_pool = rusty_pool::Builder::new()
|
||||
.core_size(4)
|
||||
.max_size(1024)
|
||||
.keep_alive(Duration::from_secs(60 * 60))
|
||||
.build();
|
||||
let thread_pool_mutex = Arc::new(Mutex::new(thread_pool));
|
||||
|
||||
let mut threads = Vec::new();
|
||||
|
Reference in New Issue
Block a user