Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset stats in CircuitBreaker instance #734

Open
buccfer-knauf opened this issue Mar 6, 2023 · 4 comments
Open

Reset stats in CircuitBreaker instance #734

buccfer-knauf opened this issue Mar 6, 2023 · 4 comments

Comments

@buccfer-knauf
Copy link

Node.js Version: 18.13.0

Operating System: MacOS Ventura 13.2.1

Steps to Produce Error:

This is more a question. I would like to know if there's any way to reset the stats of a CircuitBreaker instance. I have test cases that are interfering with each other since they are testing job retries. I'd like to reset the CircuitBreaker stats in a beforeEach callback 😄 .

@lholmquist
Copy link
Member

In our tests, we've been using the shutdown method and just creating new Circuits on for each test

https://github.com/nodeshift/opossum/blob/main/test/test.js#L27

test('has a name based on the function name', t => {
  const breaker = new CircuitBreaker(passFail);
  t.equals(breaker.name, passFail.name);
  breaker.shutdown();
  t.end();
});

a reset method could be interesting though

@buccfer-knauf
Copy link
Author

@lholmquist I can make that workaround. Not ideal because the CircuitBreaker is created in source code and not in test code. But a feature request to add the reset method would be much appreciated. Thank you!

@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2023

This issue is stale because it has been open 30 days with no activity.

Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants