Skip to content

Commit

Permalink
Turn off HTTP keep alive for now
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Jun 14, 2017
1 parent 9641c7a commit 9deaf62
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
<a name="0.7.3"></a>
## 0.7.3 (UNRELEASED)

#### Features

* Update built-in Mapbox GL viewer to 0.38.0
* Open backend URL in browser when starting server
* Serve favicon

#### Bug Fixes

* Turn off HTTP keep alive to avoid missing tiles in browser

<a name="0.7.2"></a>
## 0.7.2 (2017-06-08)

Expand Down
11 changes: 5 additions & 6 deletions src/webserver/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use std::str::FromStr;
use clap::ArgMatches;
use std::str;
use std::process;
use std::time::Duration;
use open;


Expand Down Expand Up @@ -154,7 +153,7 @@ viewer = true
[webserver]
bind = "127.0.0.1"
port = 6767
threads = 8
threads = 4
"#;

pub fn service_from_args(args: &ArgMatches) -> (MvtService, toml::Value) {
Expand Down Expand Up @@ -253,7 +252,7 @@ pub fn webserver(args: &ArgMatches) {
.map_or(6767, |val| val.as_integer().unwrap_or(6767)) as u16;
let threads = http_config
.get("threads")
.map_or(8, |val| val.as_integer().unwrap_or(8)) as usize;
.map_or(4, |val| val.as_integer().unwrap_or(4)) as usize;

service.prepare_feature_queries();
service.init_cache();
Expand All @@ -267,8 +266,8 @@ pub fn webserver(args: &ArgMatches) {

let mut server = Nickel::with_data(service);
server.options = Options::default().thread_count(Some(threads));
// reduce thread exhaustion caused by hypers keep_alive handling (https://github.com/hyperium/hyper/issues/368)
server.keep_alive_timeout(Some(Duration::from_secs(5)));
// Avoid thread exhaustion caused by hypers keep_alive handling (https://github.com/hyperium/hyper/issues/368)
server.keep_alive_timeout(None);
server.utilize(log_request);

server.get("/index.json",
Expand Down Expand Up @@ -382,7 +381,7 @@ pub fn gen_config(args: &ArgMatches) -> String {
# Bind address. Use 0.0.0.0 to listen on all adresses.
bind = "127.0.0.1"
port = 6767
threads = 8
threads = 4
"#;
let mut config;
if let Some(_dbconn) = args.value_of("dbconn") {
Expand Down

0 comments on commit 9deaf62

Please sign in to comment.