mirror of
https://github.com/go-kratos/kratos.git
synced 2025-11-06 08:59:18 +02:00
fix(circuitbreaker): add WithCircuitBreaker to fix WithGroup is useless (#2535)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user