fix(circuitbreaker): add WithCircuitBreaker to fix WithGroup is useless (#2535)

pull/2550/head
Ccheers 2 years ago committed by GitHub
parent d779faf091
commit 8732b76386
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      middleware/circuitbreaker/circuitbreaker.go

@ -26,6 +26,15 @@ func WithGroup(g *group.Group) Option {
}
}
// WithCircuitBreaker with circuit breaker genFunc.
func WithCircuitBreaker(genBreakerFunc func() circuitbreaker.CircuitBreaker) Option {
return func(o *options) {
o.group = group.NewGroup(func() interface{} {
return genBreakerFunc()
})
}
}
type options struct {
group *group.Group
}

Loading…
Cancel
Save