Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are commands send execute and return reply keep orders? #937

Closed
AmusementPark opened this issue Dec 23, 2015 · 3 comments
Closed

Are commands send execute and return reply keep orders? #937

AmusementPark opened this issue Dec 23, 2015 · 3 comments

Comments

@AmusementPark
Copy link

This is just a question. I'm new to node redis and I'm reading the source code and find the command are send by socket one by one in order. But if then the reply is also keeps the order? i.e. 1st execute -> 1st reply, 2nd execute -> 2nd reply

@BridgeAR
Copy link
Contributor

The order is always respected with some very minor exceptions. The exceptions are (I expect you fire a command sync before the following mentioned commands):

  1. you use client.batch().exec() or client.multi().exec_atomic() (missing commands)
  2. you pass wrong types to the pass argument in client.auth(pass, [callback])
  3. you fire a command after you closed the connection using client.quit

Those should be all exceptions.

In those cases the result for the mentioned commands are returned async but the return value is handled by the client itself right away and therefor the execution order will not be the same. It is possible to handle those return values in order too but I have to think about it further at some point, since the solution that came to my mind would have a minor performance penalty and I do not see a real need to guarantee the execution order in those cases too.

@AmusementPark
Copy link
Author

Great, very clear explanation. Thanks BridgeAR

@BridgeAR
Copy link
Contributor

BridgeAR commented Mar 7, 2016

From v.2.5.0 on, all commands are going to be executed in order and the former listed exceptions are handled properly in order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants