Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted out refactoring from #1630 ~~Had to also add a `subscribeSync` method on `ShapeStream` otherwise we cannot guarantee that `Shape` is up to date when the stream is up to date, since the processing is done asynchronously. We have three options:~~ ~~1. We re-introduce the `PromiseOr` abstractions in order for the single `subscribe` call to handle both sync and async~~ ~~2. We introduce an explicit `subcsribeSync` like I have done here, which provides strong guarantees on up-to-date synchronicity~~ ~~3. We change `Shape` to maintain it's own "up to date" logic as it is not guaranteed that when the stream is up to date that the `Shape` will have materialized its local state fully, since processing is async~~ Reintroduced thin version of sync + async handling in the queue to maintain the current API and intended behaviour. I've discussed with @kevin-dp and we think that actually making the processing callbacks create backpressure on the stream rather than the stream collecting the responses non-stop might be a better API and allow the developers to choose the pace at which the stream will collect data through the choice of processing callback. Will open a new PR for this, so we can merge this one with the refactor.
- Loading branch information