Skip to content

feat: support retrying generator and async generator functions#611

Closed
jd wants to merge 1 commit intomainfrom
devs/jd/feat/generator-retry/I0abf3bc716f6080245a1f8633df48e53c714eb83
Closed

feat: support retrying generator and async generator functions#611
jd wants to merge 1 commit intomainfrom
devs/jd/feat/generator-retry/I0abf3bc716f6080245a1f8633df48e53c714eb83

Conversation

@jd
Copy link
Owner

@jd jd commented Feb 24, 2026

Fixes #63
Fixes #64
Fixes #66
Fixes #138

Add retry support for sync and async generator functions. When a
generator decorated with @Retry raises an exception, the retry logic
kicks in and re-calls the generator function, continuing to yield
values from the new generator.

  • Add is_generator_callable() and is_async_gen_callable() detection
    utilities in _utils.py
  • Add sync generator wrapper in BaseRetrying.wraps()
  • Add async generator wrapper in AsyncRetrying.wraps()
  • Route async generators to AsyncRetrying in retry()
  • Document generator retry behavior and caveats

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Fixes #63
Fixes #64
Fixes #66
Fixes #138

Add retry support for sync and async generator functions. When a
generator decorated with @Retry raises an exception, the retry logic
kicks in and re-calls the generator function, continuing to yield
values from the new generator.

- Add is_generator_callable() and is_async_gen_callable() detection
  utilities in _utils.py
- Add sync generator wrapper in BaseRetrying.wraps()
- Add async generator wrapper in AsyncRetrying.wraps()
- Route async generators to AsyncRetrying in retry()
- Document generator retry behavior and caveats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change-Id: I0abf3bc716f6080245a1f8633df48e53c714eb83
@jd jd closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant