Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: retry and retry_async support streaming rpcs (#495)
From #485: > Server streaming libraries return an iterable that can asynchronously yield data from the backend over time. Some of our libraries need to provide a wrapper around the raw stream to do some local processing, before passing the data to the user. > > It would be useful to wrap this whole pipeline in a retry decorator, so that if the stream breaks mid-way through, we can recover and continue yielding data through our generator as if nothing happened. > > Unfortunately, the current implementation returns the result of the target function directly, so generators will not yield values and exceptions through the retry block This PR addresses the issue by adding retry_target_generator functions to both the async and sync retry modules, which yield through the target rather than call it directly. Generator mode can be enabled using the is_generator argument on the decorator. Fixes #485 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]> Co-authored-by: Victor Chudnovsky <[email protected]>
- Loading branch information