Comments (7)
I answer to myself :
given a circuit breaker is associated with a thread lock and that the lock is taken whenever a call is done on/with the circuit breaker then yes it's safe to use the same breaker instance with multiple threads, concurrently running.
But then any combination of threads using the same circuit will be limited by this : only one "call" at a time will be processed given this lock.
But what if we don't want this behavior but still want to use/share the same breaker between multiple threads ?
I'm thinking : there could simply be a lock-less version of the circuit breaker.. which could be the "base" one, and the lock version of the circuit breaker would simply subclass the lock-less version and add the lock and use it..
wdyt?
from pybreaker.
Yes, I think that's a great idea!
On Mon, Jul 20, 2015, 10:58 AM GrΓ©gory Starck [email protected]
wrote:
I answer to myself :
given a circuit breaker is associated with a thread lock and that the lock
is taken whenever a call is done on/with the circuit breaker then yes it's
safe to use the same breaker instance with multiple threads, concurrently
running.But then any combination of threads using the same circuit will be limited
by this : only one "call" at a time will be processed given this lock.But what if we don't want this behavior but still want to use/share the
same breaker between multiple threads ?I'm thinking : there could simply be a lock-less version of the circuit
breaker.. which could be the "base" one, and the lock version of the
circuit breaker would simply subclass the lock-less version and add the
lock and use it..wdyt?
β
Reply to this email directly or view it on GitHub
#3 (comment).
from pybreaker.
I've think again about it : probably the lock should still be more than necessary (for the circuit breaker failure count), but it's not necessary to have it locked while you actually call/execute the "wrapped" function..
from pybreaker.
the next step would be to propose a PR I guess ;)
from pybreaker.
That would be nice! π
from pybreaker.
@gst @danielfm did this get any further?
from pybreaker.
not on my side sorry. not anymore user of pybreaker.
from pybreaker.
Related Issues (20)
- Error thrown when state is missing on Redis HOT 1
- proposal: adding a name property to CircuitBreaker HOT 1
- Chaining exception into the CircuitBreakerError HOT 2
- New release HOT 1
- Is the lock effective even across multiple server processes?
- Allow installing CircuitBreakerStorageBasedTestCase as a pip extra
- Exceptions in generators have wrong location
- Old versions of Python
- Python 3 support HOT 5
- Performance issues for multithreading
- Monitoring two or more funcions HOT 1
- CircuitBreakerError hiding a real ConnectTimeout HOT 3
- Maintainership HOT 1
- TTL on Redis HOT 1
- pybreaker should provide getter for the time remaining till the circuit changes state from open to half-open
- README sentence left hanging HOT 2
- Missing py.typed Marker HOT 3
- Contextmanager / `with` API? HOT 2
- define two CircuitBreaker problem HOT 1
- (π) incorrect typing for exclude argument HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pybreaker.