I need to repeat the query if the field of the returned object has the value 'INPROGRESS' with a delay so as not to clog up the server.
If another field value is returned, the loop stops and I perform some action in subscribe()
with its response.
My attempts so far have ended up with this code, where unfortunately the queries repeat infinitely.
this.service
.query(id: number)
.pipe(
repeatWhen(obs => obs.pipe(delay(1000))),
filter((response) => response.Status === 'INPROGRESS'),
take(1),
)
.subscribe(...)