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

197
Vistas
Will NodeJS Block Concurrent Calls to Async Function

I have an async function that will cache the result of an expensive port scan for RTSP cameras. Several workers created using setInterval might be calling this function around the same time. I'm wondering will all workers wait until the first promise is resolved and then get the cached result or will each worker start another scan?

/**
 * Get either the cached rstp scan or perform a new one.
 * @param port: port number being scanned
 */
export const getRtspCached = async (port: number): Promise<RstpAddr[]> => {
    const key = port.toString()
    const cached = await rtspCache.getItem<RstpAddr[]>(key)

    if (cached) {
        return cached
    }

    return getRtspForceScan(port)
}
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