moleculer
moleculer copied to clipboard
Fallback middleware not invoked when circuit breaker is open
Current Behavior
Fallback middleware is not invoked when circuit breaker is in an open state.
Expected Behavior
Fallback middleware should be invoked when circuit breaker is in an open state, if a fallback response function is supplied.
Failure Information
Steps to Reproduce
- Enable circuit breaker.
- Provide fallback response to action.
- Trip circuit breaker.
- Observe fallback response is only invoked in closed or half-open states.
Reproduce code snippet
https://codesandbox.io/s/moleculer-sample-gow26
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
- Moleculer version: v0.13.9
- NodeJS version: v8.10.0
- Operating System: OS X v10.14.5
The problem is that fallback is a middleware which wraps the action handler. But the service not available error triggered in the broker.call where no middleware. Currently I don't know how we can handle it.