joaojeronimo / node_redis_cluster

A thin wrapper over node_redis to make it work with Redis Cluster
53 stars 17 forks source link

Function r.multi() returns undefined object #21

Open umarovt opened 9 years ago

umarovt commented 9 years ago

Object everything works fine my code, gets to this line of code:

  var multi = r.multi();

Object multi gets undefined. Do you have an idea maybe?

I should also mention, that if i use r.get and r.set the system works fine, but i should use transactions.

h0x91b commented 9 years ago

If you use a linux like system there is no need to use multi() due of driver async behaviour...

umarovt commented 9 years ago

Of course i need to use multi(), because i need to prevent that between get and set command, no other process reads that property or changes it.

I think that's not about linux drivers async behaviour.

I hope i got your point.

h0x91b commented 9 years ago

You are right but not when you use hiredis async lib in the cluster mode... Whole bulk of received data is processed by each redis instance, so no other process can be in a middle state.. But anyway, I'll add a multi to "fast-driver" for backward compatibility.

BTW do not forget that each command of "multi" may be executed on different redis...

Thanks.

umarovt commented 9 years ago

Thanks for this quick reply and help. I will check on this hiredis async lib also.

Yeah I understand that but before my multi call i only close one key value, which is always in the same cluster server because of redis hash function so i would not have problems with that. Thank you.

umarovt commented 9 years ago

Please, let me know about the improvement that I can download it. Thank you. :+1:

h0x91b commented 9 years ago

I am sorry, have no time to check it against cluster driver, could you please check it?

In your project directory go to node_modules/redis-cluster/node_modules delete a redis-fast-driver folder and make a clone by git clone -b fake-multi https://github.com/h0x91b/redis-fast-driver.git then cd redis-fast-driver and compile it by npm install

then run your code... Sorry, but I am really busy today..

repo itself there: https://github.com/h0x91b/redis-fast-driver/tree/fake-multi

umarovt commented 9 years ago

Sorry that i bother you so much, but even if then fix, r.multi() returns undefined object.

I checked the code, but could understand it enough that i could figure out what is going on. If you would find some time in future days i would appreciate it. Thanks for your help so far!

umarovt commented 9 years ago

I just check your example script and command is returning multi object as expected. But if i change example library of that library command returns undefined.

h0x91b commented 9 years ago

Ok, no problem, I`ll do it tomorrow