http poller using rxjs timer and waitUntil doesn't work

Discussão em 'Angular' iniciado por user10617993, Março 6, 2025.

  1. user10617993

    user10617993 Guest

    With rxjs 7.5.7, I return a promise when a polling http request will finally returns true after several false values, but takeUntil used is never called again.

    I tried to following code:

    return timer(0, 5000).pipe(
    takeUntil(this.http.get('https://testapi/isTrue'))
    .pipe(filter((isTrue: boolean) => {
    return isTrue; // filter method filters false values so they are not emitted
    }))
    )
    ).toPromise();


    Note: https://testapi/isTrue returns false several times and true at the end.

    But after the first call to the http query request this.http.get() initiated by the timer whose call result is false, nothing happens after 5 seconds of timer, no error, this.http.get() in takeUntil is not called anymore.

    So what is wrong with my instructions?

    Note 2: The promise returned is correctly consumed

    Continue reading...

Compartilhe esta Página