pass timeout headers in proper format

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2022-03-21 14:09:08 +03:00
parent fb6e2c8845
commit 42b93ce57e
2 changed files with 13 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ package grpc
import (
"context"
"strings"
"sync"
"time"
@@ -59,6 +60,9 @@ func newPool(size int, ttl time.Duration, idle int, ms int) *pool {
}
func (p *pool) getConn(ctx context.Context, addr string, opts ...grpc.DialOption) (*poolConn, error) {
if strings.HasPrefix(addr, "http") {
addr = addr[strings.Index(addr, ":")+3:]
}
now := time.Now().Unix()
p.Lock()
sp, ok := p.conns[addr]
@@ -126,7 +130,7 @@ func (p *pool) getConn(ctx context.Context, addr string, opts ...grpc.DialOption
}
p.Unlock()
// create new conn
// create new conn)
cc, err := grpc.DialContext(ctx, addr, opts...)
if err != nil {
return nil, err