0

I am using Redis for session management on SailsJS. I am facing two issues frequently on Azure:

  1. user config hook took too much time to load. I get this error quite often.
  2. Redis connection keeps on dropping. I am using node_redis to connect to azure redis and following is my redis configuration:

    redisConfig : { host: 'XXXXXX.redis.cache.windows.net', port: 6380, ttl: 1000 * 60 * 60 * 24 * 30, db: 2, tls: {servername: 'XXXXX.redis.cache.windows.net'}, retry_unfulfilled_commands: true, enable_offline_queue: true, auth_pass: '', retry_strategy: function (options) { if (options.error && options.error.code === 'ECONNREFUSED') { // End reconnecting on a specific error and flush all commands with a individual error return new Error('The server refused the connection'); } if (options.total_retry_time > 1000 * 60 * 5) { // End reconnecting after a specific timeout and flush all commands with a individual error return new Error('Retry time exhausted'); } if (options.times_connected > 20) { // End reconnecting with built in error return new Error('Retry count exceeded 10'); } // reconnect after return Math.max(options.attempt * 300, 5000); } }

Many times I am not able to access this Redis but still I don't get any error prompted by the app for the same.

1 Answers1

0

Add hookTimeout:120000 in the .sailsrc file.This worked to inc the timeout for user config loading. Adding this in production or development config files was not helping as prod/dev env vars are not available when userconfig hook timeout is set.