dmexe / failsafe-rs Goto Github PK
View Code? Open in Web Editor NEWA circuit breaker implementation for rust
A circuit breaker implementation for rust
Hey,
This is commit: d8c6b73#diff-e6580009c99953c9f2fe050c1acef12a is in my opinion sufficent to bump the version number
This will solve some resolution panics that I have received thanks
Have you considered expanding this library to add other distributed reliability tools, like BulkHeads, RateLimiters, and Retry(s)? It would probably require a serious re-org to move all the stuff in the base module into a more reasonable place, but it also would be nice to have a Rust alternative to r4j or Hystrix.
Edit: I'd be willing to help, but I don't want to sink any time into it if you're not interested in taking the library in that direction and/or supporting it.
Thank you very much for this crate!
I have one question, could you please add an example how the circuit breaker is shared via multiple functions... eg
use failsafe::{CircuitBreaker, Config, Error};
use rand::{thread_rng, Rng};
fn dangerous_call() -> Result<(), ()> {
if thread_rng().gen_range(0, 2) == 0 {
return Err(());
}
Ok(())
}
fn caller(circuit_breaker: XXXX) {
for n in 0..100 {
match circuit_breaker.call(|| dangerous_call()) {
Err(Error::Inner(_)) => {
eprintln!("{}: fail", n);
}
Err(Error::Rejected) => {
eprintln!("{}: rejected", n);
break;
}
_ => {}
}
}
}
fn main() {
caller(Config::new().build());
}
I have no clue what the type XXXX would be. Maybe others have the same issue.
Thanks a lot.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.