Skip to content

Commit 5f0926a

Browse files
committed
Update description of redis' asynchronous API usage
1 parent 58c1a94 commit 5f0926a

File tree

1 file changed

+1
-4
lines changed
  • src/data/markdown/docs/02 javascript api/07 k6-experimental

1 file changed

+1
-4
lines changed

src/data/markdown/docs/02 javascript api/07 k6-experimental/02 redis.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,4 @@ which operate in a synchronous manner,
2727
the Redis `Client` operates in an asynchronous manner.
2828
In practice, this means that using the Redis `Client`'s methods won't block test execution,
2929
and that the test will continue to run even if the Redis `Client` isn't ready to respond to the request.
30-
31-
This new execution model does introduce a potential caveat: to depend on operations against Redis, all following operations should be made in the context of a [promise chain](https://javascript.info/promise-chaining).
32-
As the [Redis Client example](/javascript-api/k6-experimental/redis/client#example) demonstrates, whenever there is a dependency on a Redis operation result or return value, the operation should be wrapped in a promise itself.
33-
This way, a user can perform asynchronous interactions with Redis in a seemingly synchronous manner.
30+
However, achieving a seemingly synchronous behavior can be done using the `async/await` syntax. When preceding an asynchronous Redis `Client` operation with the `await` keyword in the context of an `async` function, the execution of the function will wait for the operation to complete before continuing its execution.

0 commit comments

Comments
 (0)