I'm using ioredis module in nodejs to manage redis client. sometimes when executing search(I'm using Redisearch), I'm getting this error into my application.
ReplyError: Timeout limit was reached
at parseError (/home/robsom/Documents/test_redis/backend/node_modules/redis-parser/lib/parser.js:179:12)
at parseType (/home/robsom/Documents/test_redis/backend/node_modules/redis-parser/lib/parser.js:302:14) {
command: {
name: 'FT.SEARCH',
args: [
'idx_contact',
'(@escaped_name:*99329382*)|(@number:*99329382*)',
'LIMIT',
'0',
'20',
'SORTBY',
'escaped_name',
'ASC'
]
}
}
THIS IS THE METHOD THAT I USE TO CONNECT TO THE REDIS INTO MY APPLICATION
const redisConn = async () => {
if(!process.env.CACHE){
return null
}
try {
const redis = new Redis();
const conn = () => new Promise((resolve, reject) => {
redis.on('error', async (err) => {
if (err.code === 'ECONNREFUSED') {
console.error(`Redis connection error: ${err}.`)
await redis.quit()
}
else {
console.error(`Redis encountered an error: ${err.message}.`)
}
reject(err)
})
redis.on('connect', () => {
// console.log('CacheStore - Connection status: connected');
resolve(redis);
})
redis.on('end', () => {
// console.log('CacheStore - Connection status: disconnected');
});
redis.on('reconnecting', () => {
// console.log('CacheStore - Connection status: reconnecting');
});
});
return await conn();
} catch (e) {
console.error(e);
return Promise.resolve([]);
}
}
My OS is ubuntu 20.04
node version v16.13.1
redis version: Redis server v=6.2.6 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=b7dc414a57056789
ioredis version: "ioredis": "^5.2.3",
Aways when I open the redis conection with const redis = new Redis(); I'm closing with "await redis.quit()" into my funcion. The aplication has about 20 user with execute some contacts query that has about 90000 registry and a ticket query with has about 200000 tickets. All this registry is saved in type hash in redis
I'm try make a search using ioredis and want get a response without error