Skip to content

Commit 793d3ed

Browse files
committed
Auto merge of #1666 - sgrif:sg-configurable-server-threads, r=jtgeibel
Make the number of threads on the server configurable 50 is probably way too high. @jtgeibel and I are interested in seeing how this is affecting our memory usage, it'd be great to configure this without a redeploy.
2 parents a620969 + 42be196 commit 793d3ed

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/bin/server.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ fn main() {
4242
.and_then(|s| s.parse().ok())
4343
.unwrap_or(8888)
4444
};
45-
let threads = if config.env == Env::Development {
46-
1
47-
} else {
48-
50
49-
};
45+
let threads = env::var("SERVER_THREADS")
46+
.map(|s| s.parse().expect("SERVER_THREADS was not a valid number"))
47+
.unwrap_or_else(|_| {
48+
if config.env == Env::Development {
49+
1
50+
} else {
51+
50
52+
}
53+
});
5054

5155
let server = if env::var("USE_HYPER").is_ok() {
5256
println!("Booting with a hyper based server");

0 commit comments

Comments
 (0)