krakenjs / levee Goto Github PK
View Code? Open in Web Editor NEWA circuit-breaker pattern implementation with fallback support.
A circuit-breaker pattern implementation with fallback support.
I want to use Levee around my axios instance but if I have understood correctly, Levee only works with functions that supports callbacks and not promises. So is there any plan to do provide such functionality? otherwise i can raise a PR for it.
When trying the Levee Basic Example, the following error gets thrown.
Williams-MacBook-Pro:levee-basic-example blaine$ node index.js
/Users/blaine/Documents/node_modules/wreck/lib/index.js:474
return this._shortcutWrap('GET', uri, options, callback);
^
TypeError: this._shortcutWrap is not a function
at Object.internals.Client.get [as execute] (/Users/blaine/Documents/node_modules/wreck/lib/index.js:474:17)
at zalgo (/Users/blaine/Documents/node_modules/levee/lib/zalgo.js:28:12)
at Breaker._run (/Users/blaine/Documents/node_modules/levee/lib/breaker.js:125:13)
at Breaker.run (/Users/blaine/Documents/node_modules/levee/lib/breaker.js:60:15)
at Object.<anonymous> (/Users/blaine/Documents/levee-basic-example/index.js:21:9)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I made a quick repo to demonstrate: https://github.com/wbprice/levee-basic-example
blaine$ node -v
v6.9.1
Update: Seems to be an issue with Wreck
. I was playing with examples/http.js
and it worked using the version of Wreck that comes with Levee, but failed when updating Wreck to the latest version.
Some modules communicate errors via EventEmitter error
events. This current API doesn't support any way to allow those errors to contribute to breaker management. Add API to allow this behavior.
Currently there is no way to run isFailure
to conditionally mark timeouts as a failure โ it would be good to have this feature!
Hi there,
Love this module!
Just wandering if I am making multiple requests to different endpoints, do I need a circuit per endpoint url?
Thanks
Louis
hoek < 4.2.1 or >= 5.0.0 < 5.0.3
pollutes the Object
prototype.
More details here: https://snyk.io/vuln/npm:hoek:20180212
Hi when doing a request with for example the request module, sometimes you want to do the request as streams and pipe the response. Meaning that there is no callback, instead you have to watch for the stream returned by request.get
being destroyed (maybe with an error).
It would be awesome if levee supported streaming.
Basically breaker.run
will return a stream and you have to attach to .on('close', ...)
and .on('error', ...)
, etc. for breaking/timeout etc.
The module end-of-stream
would be handy for this.
Does levee
support request types other than GET? It would be nice to be able to do POST, PUT, DELETE and other types of request.
Hi folks. I wanted to give some feedback after using it for a week and suggest an improvement to the documentation. I discovered fairly late into my exploration that execution through a circuit instance is synchronous. Adding this piece to the documentation might be very helpful for high-level understanding of Levee for newcomers. Thanks!
I want to be able to run circuitBreaker
with extra options for the context.
For example:
I want to be able to do
circuit = levee.createBreaker(wreck.get, circuitOptions);
circuit.run(uri, {header: <someHeaderInfo>, timeout: timeOutValue}, function (err, req, payload) {
.......
.......
});
This does not seem possible today as run
only takes the context
and callback
as arguments. Am i missing something ? I went down the path of understanding if I can stash uri and the extra options information into context itself, but i quickly realized the execute
function that actually invokes the operation in the breaker forces arguments to just be the context and callback.
If this is indeed a bug, I would like to take a stab at fixing it.
Returning if the circuit is closed/open/halfopen on the stats will be helpful
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.