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

179
Vistas
How to conditionally return value in `async-retry`

I'm using async-retry node module. I need to return value if a condition meets other than that I want to retry.

Here is what I'm trying to do but not working:

 await retry(
  async () => {
    const lists = await this.projectPlanService
      .getProjectPlans(jwtData);
    const listsWithCount = await this.populateSiteCounts(lists as ProjectPlan[]);
    // if the condition meets then skip retrying, if not then retry again -  how to do that?
    if (lists.some(o => o.id === projectPlan.id)) {
      return res.send({
        success: Boolean(projectPlan.id),
        projectPlanId: projectPlan.id,
        lists: listsWithCount?.sort((a, b) => b.id - a.id),
      });
    }
    return false;
  },
  {
    retries: 5,
  },
);
about 4 years ago · Juan Pablo Isaza
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