Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda