Make worker threads configurable

This commit is contained in:
Valentin Brandl 2019-05-01 16:37:51 +02:00
parent 852a31315d
commit 7b45d72b97
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D

View File

@ -101,6 +101,9 @@ struct Opt {
#[structopt(short = "d", long = "domain", default_value = "hitsofcode.com")]
/// Interface to listen on
domain: String,
#[structopt(short = "w", long = "workers", default_value = "4")]
/// Number of worker threads
workers: usize,
}
fn pull(path: impl AsRef<Path>) -> Result<(), Error> {
@ -348,7 +351,7 @@ fn main() -> std::io::Result<()> {
.service(web::resource("/view/bitbucket/{user}/{repo}").to(overview::<Bitbucket>))
.default_service(web::resource("").route(web::get().to(p404)))
})
.workers(4)
.workers(OPT.workers)
.bind(interface)?
.run()
}