-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Disable ready check
Zihua Li edited this page Feb 28, 2022
·
3 revisions
By default, after connecting to the Redis server, ioredis sends an "INFO" command to the server in order to:
- Make sure the connection actually works.
- Make sure the Redis server is ready to accept commands. For example, the server may be not available when it just started and is still loading data from disks, and in this case, ioredis will wait until the server finishes loading.
So the flow looks like:
emit "connect" event -> perform ready check -> emit "ready" event
However, when the "INFO" command is not available, you can disable the ready check with enableReadyCheck
:
import Redis from 'ioredis';
const redis = new Redis({ port: 6380, enableReadyCheck: false });
This way, ioredis won't perform the ready check. So the flow looks like:
emit "connect" event -> emit "ready" event