-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Description
Description
We are doing some disaster recovery testing and have stopped our db in order to make sure the node server can respond with a valid error page to the front end. When we stop the db, it takes about 5min for the server to get back a response from redis. I suspect that the socket timeout is not being reset to 0 because of the 5min delay in response. I have tried a bunch of configurations including disabling the offline queue, changing the keepAlive, changing the connect timeout, etc. Nothing seems to change this behaviour.
I've replicated this using the simple client code below.
const { createClient } = require('redis');
const redisOpts = {
socket: {
host: '*****',
port: ****
},
username: '****',
password: '****',
disableOfflineQueue: true
}
async function run() {
const client = createClient(redisOpts);
client.on('error', err => console.log('Redis Client Error', err));
client.on('ready', () => {
console.log('connected')
});
try {
await client.connect();
} catch (e) {
console.log('failed to connect', e);
}
let counter = 0;
console.log('setting value');
try {
await client.set('testkey', counter);
} catch (e) {
console.log('failed to set', e);
}
let value;
try {
value = await client.get('key');
} catch (e) {
console.log('failed to get', e);
}
console.log(`value ${value}`);
await client.disconnect();
}
run();
Node.js Version
18.18.1
Redis Server Version
redis_version:6.2.10
Node Redis Version
4.6.8
Platform
Linux
Logs
No response
botflux