Changed threadpool to rusty_pool for a dynamic thread pool
This commit is contained in:
@ -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