node_redis_cluster icon indicating copy to clipboard operation
node_redis_cluster copied to clipboard

Function r.multi() returns undefined object

Open umarovt opened this issue 9 years ago • 9 comments

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.

umarovt avatar Aug 12 '15 17:08 umarovt

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

h0x91b avatar Aug 12 '15 18:08 h0x91b

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.

umarovt avatar Aug 12 '15 18:08 umarovt

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.

h0x91b avatar Aug 12 '15 18:08 h0x91b

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 avatar Aug 12 '15 18:08 umarovt

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

umarovt avatar Aug 13 '15 10:08 umarovt

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

h0x91b avatar Aug 13 '15 11:08 h0x91b

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 avatar Aug 13 '15 12:08 umarovt

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.

umarovt avatar Aug 13 '15 12:08 umarovt

Ok, no problem, I`ll do it tomorrow

h0x91b avatar Aug 13 '15 12:08 h0x91b