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

Update Options #109

Open
ttessarolo opened this issue Feb 26, 2019 · 2 comments
Open

Update Options #109

ttessarolo opened this issue Feb 26, 2019 · 2 comments

Comments

@ttessarolo
Copy link

ttessarolo commented Feb 26, 2019

In my code I need to update options for a brake already instantiated (to be more specific I need to update the timeoutvalue).

I'm using Brakes internals to do that:

brake._masterCircuit._opts = Object.assign( {}, brake._masterCircuit._opts, newOptions );

Could be a nice to have an updateOptions(opts) method attached to brake instance to have the same result without touching internals.

@awolden
Copy link
Owner

awolden commented Feb 27, 2019

That would be nice. I will flag this as an enhancement that anyone can pickup and PR the library. I'm curious: why do you have to update the timeout on a running circuit?

@ttessarolo
Copy link
Author

Is due to the logic of the framework I'm writing.
First I instantiate all the gRPC clients using Breaks.
The you can specify options for each client.

Thus you have (just an example):

// Instantiate the app and load the gRPC clients
const app = Framework({proto_file: services.proto})

// Define specific gRPC call options
app.remote("Service.method", {cache: true, timeout: 100, fallback: () => "Opss"})

Thus first I create breakes, then I define options.

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