Does the node-redis client.auth callback override the prepared event?

From node-redis github documentation:

NOTE. Your client.auth () call doesn't have to be inside a ready-made handler. If you do it incorrectly, the client will throw an error that looks something like this: Readiness check error: ERR operation not allowed

Does this mean that when client.auth executes the callback passed to it, it is safe to assume that this connection is also ready for normal commands? If not, then one should juggle two callback functions, determining which one was called second?


source to share

1 answer

If no authentication is required, node-redis sends INFO to the server to determine when it is ready and then fires a ready event (see ).

When auth is required, it looks like redis will only start accepting commands after authorization is complete (see ).

So what I would do is react to a "ready" event when not authenticating and not responding to the auth callback when authenticating (perhaps with help {no_ready_check: true}

when creating a client).



All Articles