title: Observable race condition - code gets executed too fast
body: <p>in my code I export a csv file. Before the export happens, I need to modify some data. But while I do this, I'm experiencing a race condition. While the id gets set correctly, the number only gets updated after the method got called a second time.</p>
  <p>I think the error is, that the return gets executed before the observable finished. How can I solve this?</p>
  <pre><code>  public exportAsCSV(
      arr: ArrEntity[],
      origin: string,
      id?: string,
    ): Observable&lt;Blob&gt; {
      let headers = new HttpHeaders();
  
      if (arr &amp;&amp; arr.length &gt; 0) {
        headers = headers.append(
          xxx
        );
  
        if (origin === 'table') {
          this.getValues(3).subscribe(() =&gt; {
          for (const a of arr) {
            a.id = id; //works fine
  
            a.number = this.getNumberById(a.number); // only correct after 2nd call
           }
          });
        }
  
        return this.http.post(
          url,
          {
            chargeLogEntities: arr,
          },
          {
            headers: headers,
            responseType: 'blob',
          },
        );
      } else {
        return Observable.of();
      }
    }
  </code></pre>