fengsp / pencil

A web application microframework for Rust
https://fengsp.github.io/pencil/
Other
872 stars 43 forks source link

Add ability to set thread count. #25

Closed afaur closed 7 years ago

afaur commented 8 years ago

Uses handle instead of handle_threads. This change will allow the env var THREADS to be set with a thread count value, or it will default to 10. http://docs.maidsafe.net/crust/master/hyper/server/struct.Server.html#method.handle_threads

> cargo run
   Compiling project v0.1.0 (file:///path)
     Running `target/debug/file`
DEBUG:file: Listening at 127.0.0.1:5000 (root: /path).
DEBUG:hyper::server: threads = 10

> THREADS=15 cargo run
     Running `target/debug/file`
DEBUG:file: Listening at 127.0.0.1:5000 (root: /path).
DEBUG:hyper::server: threads = 15

-> % THREADS=a cargo run
     Running `target/debug/file`
DEBUG:file: Listening at 127.0.0.1:5000 (root: /path/).
DEBUG:hyper::server: threads = 10