Changed threadpool to rusty_pool for a dynamic thread pool

This commit is contained in:
2021-05-19 19:48:44 +02:00
parent 806054144a
commit 204fe4d942
2 changed files with 8 additions and 3 deletions

View File

@ -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();