Open ttessarolo opened 5 years ago
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?
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.
In my code I need to update options for a brake already instantiated (to be more specific I need to update the
timeout
value).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 tobrake
instance to have the same result without touching internals.