Make http and https globalAgent options configurable

This commit is contained in:
Raul Ochoa 2015-08-27 16:28:16 +02:00
parent b3467116fe
commit 0561a28a4d
8 changed files with 48 additions and 3 deletions

View File

@ -1,9 +1,13 @@
# Changelog
## 2.11.1
## 2.12.0
Released 2015-mm-dd
New features:
- Make http and https globalAgent options configurable
* If config is not provided it configures them with default values
## 2.11.0

13
app.js
View File

@ -9,6 +9,8 @@
var path = require('path');
var fs = require('fs');
var http = require('http');
var https = require('https');
var RedisPool = require('redis-mpool');
var _ = require('underscore');
@ -72,6 +74,17 @@ var redisOpts = _.defaults(global.environment.redis, {
});
var redisPool = new RedisPool(redisOpts);
// set global HTTP and HTTPS agent default configurations
// ref https://nodejs.org/api/http.html#http_new_agent_options
var agentOptions = _.defaults(global.environment.httpAgent || {}, {
keepAlive: false,
keepAliveMsecs: 1000,
maxSockets: Infinity,
maxFreeSockets: 256
});
http.globalAgent = new http.Agent(agentOptions);
https.globalAgent = new https.Agent(agentOptions);
// Include cartodb_windshaft only _after_ the "global" variable is set
// See https://github.com/Vizzuality/Windshaft-cartodb/issues/28
var cartodbWindshaft = require('./lib/cartodb/cartodb_windshaft'),

View File

@ -196,6 +196,13 @@ var config = {
unwatchOnRelease: false, // Send unwatch on release, see http://github.com/CartoDB/Windshaft-cartodb/issues/161
noReadyCheck: true // Check `no_ready_check` at https://github.com/mranney/node_redis/tree/v0.12.1#overloading
}
// For more details about this options check https://nodejs.org/api/http.html#http_new_agent_options
,httpAgent: {
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 25,
maxFreeSockets: 256
}
,varnish: {
host: 'localhost',
port: 6082, // the por for the telnet interface where varnish is listening to

View File

@ -190,6 +190,13 @@ var config = {
unwatchOnRelease: false, // Send unwatch on release, see http://github.com/CartoDB/Windshaft-cartodb/issues/161
noReadyCheck: true // Check `no_ready_check` at https://github.com/mranney/node_redis/tree/v0.12.1#overloading
}
// For more details about this options check https://nodejs.org/api/http.html#http_new_agent_options
,httpAgent: {
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 25,
maxFreeSockets: 256
}
,varnish: {
host: 'localhost',
port: 6082, // the por for the telnet interface where varnish is listening to

View File

@ -190,6 +190,13 @@ var config = {
unwatchOnRelease: false, // Send unwatch on release, see http://github.com/CartoDB/Windshaft-cartodb/issues/161
noReadyCheck: true // Check `no_ready_check` at https://github.com/mranney/node_redis/tree/v0.12.1#overloading
}
// For more details about this options check https://nodejs.org/api/http.html#http_new_agent_options
,httpAgent: {
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 25,
maxFreeSockets: 256
}
,varnish: {
host: 'localhost',
port: 6082, // the por for the telnet interface where varnish is listening to

View File

@ -192,6 +192,13 @@ var config = {
unwatchOnRelease: false, // Send unwatch on release, see http://github.com/CartoDB/Windshaft-cartodb/issues/161
noReadyCheck: true // Check `no_ready_check` at https://github.com/mranney/node_redis/tree/v0.12.1#overloading
}
// For more details about this options check https://nodejs.org/api/http.html#http_new_agent_options
,httpAgent: {
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 25,
maxFreeSockets: 256
}
,varnish: {
host: '',
port: null, // the por for the telnet interface where varnish is listening to

2
npm-shrinkwrap.json generated
View File

@ -1,6 +1,6 @@
{
"name": "windshaft-cartodb",
"version": "2.11.1",
"version": "2.12.0",
"dependencies": {
"cartodb-psql": {
"version": "0.4.0",

View File

@ -1,7 +1,7 @@
{
"private": true,
"name": "windshaft-cartodb",
"version": "2.11.1",
"version": "2.12.0",
"description": "A map tile server for CartoDB",
"keywords": [
"cartodb"