I am using ioredis with a node application, and due to some issues at cluster I started getting:
Too many Cluster redirections. Last error: Error: Connection is closed.
Due to which all of my redis calls failed and after a very long time ranging from 1sec to 130secs.
Is there any default timeout for ioredis library which it uses to assert the call after sending command to execute to redis server?
Higher failure time of range 100secs on sending commands to redis server, is it because the the high queue size at redis due to cluster failure?
Sample code :
this.getData = function(bucketName, userKey) {
let cacheKey = cacheHelper.formCacheKey(userKey, bucketName);
let serviceType = cacheHelper.getServiceType(bucketName, cacheConfig.service_config);
let log_info = _.get(cacheConfig.service_config, 'logging_options.cache_info_level', true);
let startTime = moment();
let dataLength = null;
return Promise.try(function(){
validations([cacheKey], ['cache_key'], bucketName, serviceType, that.currentService);
return cacheStore.get(serviceType, cacheKey);
})
.then(function(data) {
dataLength = (data || '').length;
return cacheHelper.uncompress(data);
})
.then(function(uncompressedData) {
let endTime = moment();
let responseTime = endTime.diff(startTime, 'miliseconds');
if(!uncompressedData) {
if(log_info) logger.consoleLog(bucketName, 'getData', 'miss', cacheKey, that.currentService,
responseTime, dataLength);
} else {
if(log_info) logger.consoleLog(bucketName, 'getData', 'success', cacheKey, that.currentService,
responseTime, dataLength);
}
return uncompressedData;
})
.catch(function(err) {
let endTime = moment();
let responseTime = endTime.diff(startTime, 'miliseconds');
logger.error(bucketName, 'getData', err.message, userKey, that.currentService, responseTime);
throw cacheResponse.error(err);
});
};
Here
logger.error(bucketName, 'getData', err.message, userKey, that.currentService, responseTime);
started giving response time of range 1061ms to 109939ms.
Please provide some inputs.