fix: circuitbreaker use client context (#1679)

pull/1681/head
china小宇 3 years ago committed by GitHub
parent 8c9e70b47b
commit 83ebf53b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      middleware/circuitbreaker/circuitbreaker.go

@ -42,7 +42,7 @@ func Client(opts ...Option) middleware.Middleware {
}
return func(handler middleware.Handler) middleware.Handler {
return func(ctx context.Context, req interface{}) (interface{}, error) {
info, _ := transport.FromServerContext(ctx)
info, _ := transport.FromClientContext(ctx)
breaker := opt.group.Get(info.Operation()).(circuitbreaker.CircuitBreaker)
if err := breaker.Allow(); err != nil {
// rejected

Loading…
Cancel
Save