Skip to content

Does backoff-rxjs work for polling cases? #27

@wallaceicy06

Description

@wallaceicy06

I came across your library which looks very helpful for my use case. I have an API that I would like to poll regularly, but backoff when errors occur. I'm trying to figure out how I can incorporate retryBackoff into that loop, but I'm seeing strange side effects where previous iterations are not being unsubscribed.

 this.poll$.pipe(
      switchMap(() => this.backend.callApi()),
      retryBackoff(
        {
          initialInterval: 500,
          maxInterval: 5000,
          resetOnSuccess: true,
        }
      ),
      tap(() => $poll.next())
    ).subscribe(
        response => console.log('successful response'),
        error => console.log(`error: ${error}`)
    );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions