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

108
Visualizações
RxJS timeout hangs on Node.js

I never user RxJS, but now I'm working on a project which uses it.

I apologize if my question is not so clear, please do not hesitate to request for clarifications/edits.

I have an Observable which (in case of no errors) resolves very fast, but there is a timeout just in case...

I noticed that my Node.js process does not exits untill the timeout is not expired...

If I comment out this piece of code:

observable.pipe(
    timeout(3* 60 * 1000),
    catchError(() => throwError(() => new Error("timeout")))
);

the Node.js process exits without any problem.

Is there some way to unref an RxJS timeout?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I tried out a very simple example based from RXJS doc:

import { of } from 'rxjs';
import { concatMap, timeout, catchError, delay } from 'rxjs/operators';

// simulate request
function makeRequest(timeToDelay) {
  return of('Request Complete!').pipe(delay(timeToDelay));
}

of(200)
  .pipe(
    concatMap(duration =>
      makeRequest(duration).pipe(
        timeout(10500),
        catchError(() => throwError(() => new Error("timeout")))
        //catchError(error => of(`Request timed out after: ${duration}`))
      )
    )
  )
  .subscribe(val => console.log(val));

I am on Window 10, on the task manager, the process appear and disappear without waiting the timeout (10500ms).

However, when closing git bash I have:

error

But only if I launched my process like that node index.js & (& at the end to disconnect from terminal).

Unsure what the implications of the terminal telling me the process is still running, when the task manager says there is no running node process.

about 4 years ago · Juan Pablo Isaza Relatório
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