Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

311
Vistas
Error being thrown on reconnection after disconnection in node-redis client

I couldn't understand what's the reason for the SocketClosedUnexpectedlyError error fired in the code below:

const redisClient = require('redis').createClient();

redisClient.connect().then(function() {
  return redisClient.disconnect();
})
.then(function() {
  redisClient.connect();
});

If I wrap the second redisClient.connect() call inside a setTimeout() call, as shown below, the error seems to go away:

const redisClient = require('redis').createClient();

redisClient.connect().then(function() {
  return redisClient.disconnect();
})
.then(function() {
  setTimeout(function() {
    redisClient.connect();
  }, 0);
});

Can anyone please explain what's the reason for the error thrown above? The documentation of @node-redis isn't good enough to explain this.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It's a bug in node-redis v4...

https://github.com/redis/node-redis/issues/1801

https://github.com/redis/node-redis/commit/74daee302338cf2fcc1bb48aeac02be828e0c6d7

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda