You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-12-09 21:21:11 +03:00
* add cluster/node events * add test for cluster events positive branch * add cluster events docs section fixes: #1855 --------- Co-authored-by: Nikolay Karadzhov <nkaradzhov89@gmail.com>
This commit is contained in:
committed by
GitHub
parent
d6d8d8e8ed
commit
bd11e382d0
@@ -120,6 +120,24 @@ createCluster({
|
||||
|
||||
> This is a common problem when using ElastiCache. See [Accessing ElastiCache from outside AWS](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/accessing-elasticache.html) for more information on that.
|
||||
|
||||
### Events
|
||||
|
||||
The Node Redis Cluster class extends Node.js’s EventEmitter and emits the following events:
|
||||
|
||||
| Name | When | Listener arguments |
|
||||
| ----------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------- |
|
||||
| `connect` | The cluster has successfully connected and is ready to us | _No arguments_ |
|
||||
| `disconnect` | The cluster has disconnected | _No arguments_ |
|
||||
| `error` | The cluster has errored | `(error: Error)` |
|
||||
| `node-ready` | A cluster node is ready to establish a connection | `(node: { host: string, port: number })` |
|
||||
| `node-connect` | A cluster node has connected | `(node: { host: string, port: number })` |
|
||||
| `node-reconnecting` | A cluster node is attempting to reconnect after an error | `(node: { host: string, port: number })` |
|
||||
| `node-disconnect` | A cluster node has disconnected | `(node: { host: string, port: number })` |
|
||||
| `node-error` | A cluster node has has errored (usually during TCP connection) | `(error: Error, node: { host: string, port: number })` |
|
||||
|
||||
> :warning: You **MUST** listen to `error` events. If a cluster doesn't have at least one `error` listener registered and
|
||||
> an `error` occurs, that error will be thrown and the Node.js process will exit. See the [ > `EventEmitter` docs](https://nodejs.org/api/events.html#events_error_events) for more details.
|
||||
|
||||
## Command Routing
|
||||
|
||||
### Commands that operate on Redis Keys
|
||||
|
||||
Reference in New Issue
Block a user