We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It will be really impresive if you can do something like this:
def dynamic_naming(params): return "dynamic_" + params.param1 @circuit(name-handler=dynamicNaming) def external_call(param1, param2): requests.get('.......')
The text was updated successfully, but these errors were encountered:
hey @sebathi it looks good indeed. right now it's not possible because per decorator the circuit is created by the time the function is declared.
but you could achieve that with a custom decorator:
from functools import wraps from circuitbreaker import CircuitBreaker, CircuitBreakerMonitor def dynamic_circuit(name_handler, **circuit_kwargs): def inner(function): @wraps(function) def wrapper(*args, **kwargs): name = name_handler(*args, **kwargs) cb = CircuitBreakerMonitor.get(name) or CircuitBreaker(name=name, **circuit_kwargs) return cb(function)(*args, **kwargs) return wrapper return inner def dynamic_naming(*args, **kwargs): return "dynamic_" + args[0] @dynamic_circuit(name_handler=dynamic_naming) def external_call(param1, param2): requests.get('.......')
I hope my response still holds meaning to you or to others, despite the delay.
Sorry, something went wrong.
No branches or pull requests
It will be really impresive if you can do something like this:
The text was updated successfully, but these errors were encountered: