mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-27 02:45:27 +00:00
passthru worker thread count from env
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
175e1c6453
commit
5f1cab6850
|
@ -207,14 +207,13 @@ default-features = false
|
|||
version = "4.5.21"
|
||||
default-features = false
|
||||
features = [
|
||||
"std",
|
||||
"derive",
|
||||
"help",
|
||||
#"color", Do we need these?
|
||||
#"unicode",
|
||||
"usage",
|
||||
"env",
|
||||
"error-context",
|
||||
"help",
|
||||
"std",
|
||||
"string",
|
||||
"usage",
|
||||
]
|
||||
|
||||
[workspace.dependencies.futures]
|
||||
|
|
|
@ -5,7 +5,9 @@ use std::path::PathBuf;
|
|||
use clap::Parser;
|
||||
use conduit::{
|
||||
config::{Figment, FigmentValue},
|
||||
err, toml, Err, Result,
|
||||
err, toml,
|
||||
utils::available_parallelism,
|
||||
Err, Result,
|
||||
};
|
||||
|
||||
/// Commandline arguments
|
||||
|
@ -32,6 +34,10 @@ pub(crate) struct Args {
|
|||
/// Set functional testing modes if available. Ex '--test=smoke'
|
||||
#[arg(long, hide(true))]
|
||||
pub(crate) test: Vec<String>,
|
||||
|
||||
/// Override the tokio worker_thread count.
|
||||
#[arg(long, hide(true), env = "TOKIO_WORKER_THREADS", default_value = available_parallelism().to_string())]
|
||||
pub(crate) worker_threads: usize,
|
||||
}
|
||||
|
||||
/// Parse commandline arguments into structured data
|
||||
|
|
|
@ -9,12 +9,11 @@ mod tracing;
|
|||
extern crate conduit_core as conduit;
|
||||
|
||||
use std::{
|
||||
cmp,
|
||||
sync::{atomic::Ordering, Arc},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use conduit::{debug_info, error, rustc_flags_capture, utils::available_parallelism, Error, Result};
|
||||
use conduit::{debug_info, error, rustc_flags_capture, Error, Result};
|
||||
use server::Server;
|
||||
use tokio::runtime;
|
||||
|
||||
|
@ -30,7 +29,7 @@ fn main() -> Result<(), Error> {
|
|||
.enable_io()
|
||||
.enable_time()
|
||||
.thread_name(WORKER_NAME)
|
||||
.worker_threads(cmp::max(WORKER_MIN, available_parallelism()))
|
||||
.worker_threads(args.worker_threads.max(WORKER_MIN))
|
||||
.thread_keep_alive(Duration::from_secs(WORKER_KEEPALIVE))
|
||||
.build()
|
||||
.expect("built runtime");
|
||||
|
|
Loading…
Reference in a new issue