You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
Make .end flush optional and add some tests
This commit is contained in:
@@ -212,11 +212,13 @@ NOTE: Your call to `client.auth()` should not be inside the ready handler. If
|
||||
you are doing this wrong, `client` will emit an error that looks
|
||||
something like this `Error: Ready check failed: ERR operation not permitted`.
|
||||
|
||||
## client.end()
|
||||
## client.end([flush])
|
||||
|
||||
Forcibly close the connection to the Redis server. Note that this does not wait until all replies have been parsed.
|
||||
If you want to exit cleanly, call `client.quit()` to send the `QUIT` command after you have handled all replies.
|
||||
|
||||
If flush is set to true, all commands will be rejected instead of ignored after using `.end`.
|
||||
|
||||
This example closes the connection to the Redis server before the replies have been read. You probably don't
|
||||
want to do this:
|
||||
|
||||
@@ -227,7 +229,7 @@ var redis = require("redis"),
|
||||
client.set("foo_rand000000000000", "some fantastic value");
|
||||
client.end(); // No further commands will be processed
|
||||
client.get("foo_rand000000000000", function (err, reply) {
|
||||
// This won't be called anymore
|
||||
// This won't be called anymore, since flush has not been set to true!
|
||||
console.log(err);
|
||||
});
|
||||
```
|
||||
|
Reference in New Issue
Block a user