title: Retry for rxjs in nestjs
body: <pre><code>import { HttpService, Injectable } from '@nestjs/common';
  import { retry } from 'rxjs/operators';
  
  @Injectable()
  export class XXXService {
    constructor(private http: HttpService) {}
  
    predictAll() {
      return this.http
        .post('https://xxxxx/xxxxx')
        .pipe(retry(5));
    }
  }
  </code></pre>
  
  <p>then I have the following code to subscribe from the above observable</p>
  
  <pre><code>import { Inject, Injectable } from '@nestjs/common';
  import { XXXService } from '@api/services/XXX.service';
  
  @Injectable()
  export class YYYService {
  
    constructor(
      private readonly xxxService: XXXService
    ) {
      this.predictAll();
    }
  
    async predictAll() {
      await this.xxxService.predictAll().subscribe(
        ({ data }) =&gt; {
          console.log(data);
        },
        err =&gt; {
          console.log('error');
        }
      );
    }
  }
  
  </code></pre>
  
  <p>then I tried turning off my internet connection, Upon checking, 'error' is only printed once in the console which means that my observable is not retrying at all. Is there something wrong that I'm doing.</p>