Skip to content

Does auto-pipelining guarantee the order of execution? #2923

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

Open
ikigai-chiawen-c opened this issue Apr 11, 2025 · 3 comments
Open

Does auto-pipelining guarantee the order of execution? #2923

ikigai-chiawen-c opened this issue Apr 11, 2025 · 3 comments

Comments

@ikigai-chiawen-c
Copy link

Description

It isn't clear in documentation if the commands in an auto-pipeline are guaranteed to execute in order:

await Promise.all([
  redis.set('a', 1),
  redis.get('a'),
])
@bobymicroby
Copy link
Member

Promise.all is a standard method that is provided by the runtime ( nodejs in our case, not by node-redis ) 🙂

You can learn how it works here:
Promise.all

when all the promises in the given iterable fulfill. The fulfillment value is an array of fulfillment values, in the order of the promises passed, regardless of completion order. If the iterable passed is non-empty but contains no pending promises, the returned promise is still asynchronously (instead of synchronously) fulfilled.

@ikigai-chiawen-c
Copy link
Author

Thanks I know it. I am asking if the Redis library always send commands in the order of SET a 1 -> GET a, since the function call redis.set('a', 1) is invoked before redis.get('a'), when auto-pipeline is enabled.

@bobymicroby
Copy link
Member

Yes

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

No branches or pull requests

2 participants