Git Product home page Git Product logo

Comments (5)

awolden avatar awolden commented on June 6, 2024

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.

stefanpernpaintner avatar stefanpernpaintner commented on June 6, 2024

I've tested only with node 14. The issue exists with node 14 too.

from brakes.

stefanpernpaintner avatar stefanpernpaintner commented on June 6, 2024

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.

UyumazHakan avatar UyumazHakan commented on June 6, 2024

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.

awolden avatar awolden commented on June 6, 2024

This issue should be fixed in in version 3.1.0. Thank you @UyumazHakan for the collaboration.

from brakes.

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.