mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[debug] Better debug messages to try to determine if pool is slowly losing clients to forever busy
This commit is contained in:
parent
7c2eb5de35
commit
dd1918dc36
@ -30,7 +30,7 @@ var sys = require('sys'),
|
||||
pool = require('./../vendor/pool/main'),
|
||||
eyes = require('eyes'),
|
||||
min = 0,
|
||||
max = 100;
|
||||
max = 10;
|
||||
|
||||
// Setup the PoolManager
|
||||
var manager = pool.createPoolManager();
|
||||
@ -146,7 +146,7 @@ HttpProxy.prototype = {
|
||||
|
||||
// Open new HTTP request to internal resource with will act as a reverse proxy pass
|
||||
var p = manager.getPool(port, server);
|
||||
sys.puts('current pool count for ' + req.headers.host + ":" + port + ' ' +p.clients.length);
|
||||
sys.puts('Current pool count for ' + req.headers.host + ":" + port + ' ' + p.clients.length + ', Busy: ' + p.getBusy() + ', Free: ' + p.getFree());
|
||||
|
||||
p.on('error', function (err) {
|
||||
// Remark: We should probably do something here
|
||||
|
||||
9
vendor/pool/main.js
vendored
9
vendor/pool/main.js
vendored
@ -84,6 +84,14 @@ Pool.prototype.onFree = function (client) {
|
||||
if (this.pending.length > 0) this.pending.shift()(client);
|
||||
};
|
||||
|
||||
Pool.prototype.getFree = function () {
|
||||
return this.clients.filter(function (client) { return !client.busy }).length;
|
||||
};
|
||||
|
||||
Pool.prototype.getBusy = function () {
|
||||
return this.clients.filter(function (client) { return client.busy }).length;
|
||||
};
|
||||
|
||||
Pool.prototype.setMinClients = function (num) {
|
||||
this.minClients = num;
|
||||
if (this.clients.length < num) {
|
||||
@ -98,6 +106,7 @@ Pool.prototype.setMinClients = function (num) {
|
||||
Pool.prototype.setMaxClients = function (num) {
|
||||
this.maxClients = num;
|
||||
};
|
||||
|
||||
Pool.prototype.end = function () {
|
||||
this.clients.forEach(function (c) {c.end()});
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user