Replace contextx.ShrinkDeadline with context.WithTimeout (#598)
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/tal-tech/go-zero/core/contextx"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
@@ -16,7 +15,7 @@ func TimeoutInterceptor(timeout time.Duration) grpc.UnaryClientInterceptor {
|
||||
return invoker(ctx, method, req, reply, cc, opts...)
|
||||
}
|
||||
|
||||
ctx, cancel := contextx.ShrinkDeadline(ctx, timeout)
|
||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
|
||||
// create channel with buffer size 1 to avoid goroutine leak
|
||||
|
||||
Reference in New Issue
Block a user