openresty / lua-resty-balancer

A generic consistent hash implementation for OpenResty/Lua
322 stars 77 forks source link

can chash object be reinitialized? #5

Closed ssdr closed 8 years ago

ssdr commented 8 years ago

say,can I call new() for many times or not? if I call new() with nodes(a,b,c),then one object be hashed to server b; later I call new() with nodes(a,b),will the same object be hashed to server b still?

doujiang24 commented 8 years ago

@ssdr I guess you mean later I call new() with nodes(a,b,c) again ?

ssdr commented 8 years ago

no,with nodes(a, b), c is down at that time, I call new() with nodes(a, b), will it affact hash results?

doujiang24 commented 8 years ago

@ssdr Yes, I just add a test case for incr/decr weight: https://github.com/agentzh/lua-resty-balancer/blob/master/t/chash.t#L209

ssdr commented 8 years ago

@doujiang24 that sounds pretty good~ 😜

doujiang24 commented 8 years ago

Consider resolved