Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added spread single option

  • Loading branch information...
commit 0a55d25c7ad3d96335e740423d650151944edb27 1 parent 44cd713
@indutny authored
Showing with 4 additions and 3 deletions.
  1. +2 −1  app.balancer
  2. +2 −2 lib/balancer/index.js
View
3  app.balancer
@@ -14,6 +14,7 @@
"addr": "192.168.0.100:80", "hostname": "www.google.com",
"spread": {
"include": ".*",
- "exclude": "new|update|talk"
+ "exclude": "new|update|talk",
+ "single": true
}
}
View
4 lib/balancer/index.js
@@ -42,7 +42,7 @@ var Balancer = exports.Balancer = function(config) {
_spread = {};
_spread.include = parseRegExp(config.spread.include);
_spread.exclude = parseRegExp(config.spread.exclude);
-
+ _spread.single = config.spread.single ? true : false;
}
// Parse addr
@@ -103,7 +103,7 @@ function start(addr, servers, spread, log, profiler) {
id = Math.floor(Math.random() * serverslen);
} else {
// Get hashed
- id = hashIp(request, serverslen);
+ id = spread.single ? 0 : hashIp(request, serverslen);
}
// Get server
Please sign in to comment.
Something went wrong with that request. Please try again.