diff --git a/src/main.rs b/src/main.rs index 0c89d91..f957224 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,7 +54,9 @@ fn core_main() -> Result<(), Box> { .unwrap_or(8080); let db_pool = db::create_pool(db_file)?; - let state = state::State::new(db_pool); + let cpu_pool = futures_cpupool::CpuPool::new_num_cpus(); + + let state = state::State::new(db_pool, cpu_pool); let server = hyper::server::Http::new() diff --git a/src/state.rs b/src/state.rs index 18f0ce4..12b355c 100644 --- a/src/state.rs +++ b/src/state.rs @@ -18,10 +18,10 @@ pub struct State { pub type Error = Box; impl State { - pub fn new(connection_pool: Pool>) -> State { + pub fn new(connection_pool: Pool>, cpu_pool: futures_cpupool::CpuPool) -> State { State { connection_pool, - cpu_pool: futures_cpupool::CpuPool::new_num_cpus(), + cpu_pool, } }