Skip to main content
Help us improve Python packaging – donate today!

Circuitbreaker pattern for gevent apps

Project Description

gevent-breaker
==============

[![Build Status](https://travis-ci.org/daroot/gevent-breaker.svg?branch=1.0.0)](https://travis-ci.org/daroot/gevent-breaker)

Circuit Breaker pattern for gevent apps.

Install
-------

$ pip install gevent-breaker

Usage
-----

```python
from gevent_breaker import circuit_breaker, CircuitBroken
while True:
try:
# After enough errors (5 by default), raise a CircuitBroken
with circuit_breaker("breaker1"):
1/0
except ZeroDivisionError:
print("Got an exception!")
except CircuitBroken:
print("Too many errors!")
break

try:
# Don't raise a CircuitBroken, instead just wait for a period
# of time (default 60s) before trying again.
with circuit_breaker("breaker2", block=True):
1/0
except ZeroDivisionError:
print("Got an exception")
```

Release history Release notifications

This version
History Node

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
gevent_breaker-1.0.0-py2.py3-none-any.whl (6.2 kB) Copy SHA256 hash SHA256 Wheel 2.7 Jul 18, 2016
gevent-breaker-1.0.0.tar.gz (4.3 kB) Copy SHA256 hash SHA256 Source None Jul 18, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page