3rd-Eden / node-hashring

hashring is a consistent hashing algorithm for Node.js that is compatible with libketama and python's hash_ring package
MIT License
350 stars 61 forks source link

Fix the addServer error #5

Closed bunnyyiu closed 11 years ago

bunnyyiu commented 12 years ago

Should use Array.prototype.push.call instead of Array.prototype.push.apply.

3rd-Eden commented 12 years ago

Do you have an example call where this breaks? As the .apply allows a array of servers to be pushed.

bunnyyiu commented 12 years ago

Here is the example call. var hashring = require('hashring');

var ring = new hashring([ '192.168.0.102:11212', '192.168.0.103:11212', '192.168.0.104:11212']); ring.addServer('192.168.0.105:11212'); //break here ring.addServer(['192.168.0.105:11212']); //this work fine

I think it is better ignore my pull request and change the description in README.md as below is fine. ring.addServer(['192.168.0.102:11212']);

3rd-Eden commented 12 years ago

I was gonna implement the same argument format as the constructor, which would be a relatively easy fix. Would that help you out :)?

bunnyyiu commented 12 years ago

That's good, I like your argument format in constructor.

3rd-Eden commented 11 years ago

Fixed in master by using the connection-parse library