Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
RxJS - Processing HTTPrequests in sequence

I'm currently trying to process HTTP Post requests in sequence, additionally trying to repeat each failed request until it succeeds (that is a requirement) and then and only then to continue with processing other requests. My code looks like this for now (it not working as it should, retryWhen is not used properly, I am aware of that, it's used just as a starting point reference):

...
subject
  .pipe(
    concatMap(async request => await this._sendPostRequest(request)),
    retryWhen(errors =>
      errors.pipe(
        tap(error => this._logger.error('error sending request', error)),
        delayWhen(() => timer(5000))
      )
    )
  )
  .subscribe();
...
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You're close!

Just attach your retry to the promise rather than the concatenated stream as a whole.

subject.pipe(     
  concatMap(request => defer(() => sendPostRequest(request)).pipe(           
    retryWhen(error$ => error$.pipe(               
      tap((error) => console.warn('error sending request', error)),               
      delay(1000)             
    ))         
  ))
).subscribe();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!