Skip to content
Browse files

Fix last element index.

  • Loading branch information...
1 parent 977119f commit 156909a95de928cc6153729c644a956673837b2f Vadim Antonov committed Jun 14, 2012
Showing with 3 additions and 3 deletions.
  1. +2 −2 lib/consistent_hashing.js
  2. +1 −1 package.json
View
4 lib/consistent_hashing.js
@@ -64,7 +64,7 @@ ConsistentHashing.prototype.getNode = function(key) {
ConsistentHashing.prototype.getNodePosition = function(hash) {
- var upper = this.getRingLength();
+ var upper = this.getRingLength() - 1;
var lower = 0;
var idx = 0;
@@ -84,7 +84,7 @@ ConsistentHashing.prototype.getNodePosition = function(hash) {
}
if (upper < 0) {
- upper = this.getRingLength();
+ upper = this.getRingLength() - 1;
}
return upper;
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "consistent-hashing",
- "version": "0.2.0",
+ "version": "0.2.1",
"description": "A pure JavaScript implementation of Consistent Hashing",
"author": "Dai Akatsuka <d.akatsuka@gmail.com>",
"main": "./index.js",

0 comments on commit 156909a

Please sign in to comment.
Something went wrong with that request. Please try again.