many fixes for lint and context.Context usage
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
package pool
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
@@ -57,7 +58,7 @@ func (p *poolConn) Created() time.Time {
 | 
			
		||||
	return p.created
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (p *pool) Get(addr string, opts ...transport.DialOption) (Conn, error) {
 | 
			
		||||
func (p *pool) Get(ctx context.Context, addr string, opts ...transport.DialOption) (Conn, error) {
 | 
			
		||||
	p.Lock()
 | 
			
		||||
	conns := p.conns[addr]
 | 
			
		||||
 | 
			
		||||
@@ -83,7 +84,7 @@ func (p *pool) Get(addr string, opts ...transport.DialOption) (Conn, error) {
 | 
			
		||||
	p.Unlock()
 | 
			
		||||
 | 
			
		||||
	// create new conn
 | 
			
		||||
	c, err := p.tr.Dial(addr, opts...)
 | 
			
		||||
	c, err := p.tr.Dial(ctx, addr, opts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
package pool
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/unistack-org/micro/v3/network/transport"
 | 
			
		||||
@@ -12,7 +13,7 @@ type Pool interface {
 | 
			
		||||
	// Close the pool
 | 
			
		||||
	Close() error
 | 
			
		||||
	// Get a connection
 | 
			
		||||
	Get(addr string, opts ...transport.DialOption) (Conn, error)
 | 
			
		||||
	Get(ctx context.Context, addr string, opts ...transport.DialOption) (Conn, error)
 | 
			
		||||
	// Release the connection
 | 
			
		||||
	Release(c Conn, status error) error
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user