Quantcast
Channel: Active questions tagged retry-logic - Stack Overflow
Viewing all articles
Browse latest Browse all 950

"retry" decorator from Tenacity doesn't work with a generator

$
0
0

It seems the @retry decorator does not seem to work when I use a generator.

I have a code sample to illustrate my situation:

from tenacity import retry, wait_exponential@retry(wait=wait_exponential(multiplier=1, min=1, max=1))def test_retry():    print("test retry from tenacity")    for i in range(10):        if i == 0: raise Exception        yield idef gen():    yield from test_retry()bar = gen()for foo in bar:    print(foo)

When it raises the Exception, it doesn't retry.

Does somebody have an idea why this is not working?


Viewing all articles
Browse latest Browse all 950

Trending Articles