1
0
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:
Ccheers
2022-11-29 11:23:02 +08:00
committed by GitHub
parent d779faf091
commit 8732b76386

View File

@@ -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
}