Comments (5)
Hi @stefanpernpaintner thanks for raising this issue. I'm not aware of any issues with newer version of node. Do you see the same issue with other major versions of node such as 14 or 15?
from brakes.
I've tested only with node 14. The issue exists with node 14 too.
from brakes.
Here is a full example with express which shows that only "Brake 1" is considered by the stream if you run it on node > 12.16 :
const express = require('express')
const Brakes = require("brakes");
const app = express()
function promiseCall(foo) {
return new Promise((resolve, reject) => {
if (foo) resolve(foo);
else reject(foo);
});
}
const brake1 = new Brakes(promiseCall, {
name: "Brake 1",
bucketSpan: 5000,
bucketNum: 3,
waitThreshold: 5,
timeout: 200,
threshold: 0.5,
circuitDuration: 30000,
});
const brake2 = new Brakes(promiseCall, {
name: "Brake 2",
bucketSpan: 5000,
bucketNum: 3,
waitThreshold: 5,
timeout: 200,
threshold: 0.5,
circuitDuration: 30000,
});
Brakes.getGlobalStats().getHystrixStream().on('data', (stats) => {
console.log('received global stats ->', stats);
});
app.get('/', function (req, res) {
brake1.exec('bar').then(value => {
console.log(value)
})
brake2.exec("test").then(value => {
console.log(value)
})
res.send('Hello World')
})
app.listen(3000)
from brakes.
The root cause of problem is after first snapshot is processed by _rawStream. The stream gets paused and cannot pass check in main/lib/globalStats.js#L54 . Therefore, it will not able to push anymore snapshots in the stream for newer versions of Node. Please see https://nodejs.org/api/stream.html#stream_compatibility_with_older_node_js_versions . I created a pull request #121 with a fix.
from brakes.
This issue should be fixed in in version 3.1.0. Thank you @UyumazHakan for the collaboration.
from brakes.
Related Issues (20)
- nvmrc is right? HOT 2
- transpile lib? HOT 2
- Brakes modifies original error message
- Support decorator usage like in java HOT 1
- waitThreshold is too high by default HOT 1
- Update Options HOT 2
- Timing the statInterval based on bucketNum & bucketSpan HOT 2
- Do you want TypeScript types in this repo?
- Remove racist terminology
- Reported request count never goes down? HOT 4
- Slave circuits not working as per the examples HOT 1
- Single-arg fat arrow function breaks brakes HOT 2
- CircuitBrokenError is taking threshold as failure rate
- CPU growth HOT 6
- Adding isFailure function
- Fallbacks executions HOT 3
- Add isSuccess option?
- Runaway memory growth/CPU utilization HOT 1
- 2.6.0 breaks non-string errors HOT 9
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 brakes.