Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async support? #7

Open
jakubka opened this issue Aug 17, 2016 · 1 comment
Open

Async support? #7

jakubka opened this issue Aug 17, 2016 · 1 comment

Comments

@jakubka
Copy link

jakubka commented Aug 17, 2016

Hey, pybreaker doesn't behave as expected with async code on the asyncio event loop. Is it because it isn't supported or am I doing something wrong?

Here's my code:

data_services_breaker = pybreaker.CircuitBreaker(fail_max=2, reset_timeout=60)

@data_services_breaker
async def get_all_bookings():
    async with aiohttp.ClientSession() as session:
        async with session.get('https://api.githubXXXX.com/events') as resp:
            return await resp.text()

CircuitBreakerError is never thrown...

Thanks!

@danielfm
Copy link
Owner

Coroutines are not supported. PRs are welcome though! 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants