moleculer icon indicating copy to clipboard operation
moleculer copied to clipboard

Fallback middleware not invoked when circuit breaker is open

Open d3d-z7n opened this issue 6 years ago • 1 comments

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

  1. Enable circuit breaker.
  2. Provide fallback response to action.
  3. Trip circuit breaker.
  4. 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

d3d-z7n avatar Jun 03 '19 21:06 d3d-z7n

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.

icebob avatar Jan 14 '23 17:01 icebob