Code Monkey home page Code Monkey logo

Comments (7)

gst avatar gst commented on June 2, 2024

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.

danielfm avatar danielfm commented on June 2, 2024

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.

gst avatar gst commented on June 2, 2024

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.

gst avatar gst commented on June 2, 2024

the next step would be to propose a PR I guess ;)

from pybreaker.

danielfm avatar danielfm commented on June 2, 2024

That would be nice! πŸ˜„

from pybreaker.

robertlagrant avatar robertlagrant commented on June 2, 2024

@gst @danielfm did this get any further?

from pybreaker.

gst avatar gst commented on June 2, 2024

not on my side sorry. not anymore user of pybreaker.

from pybreaker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.