ing
This commit is contained in:
parent
16ddb936c5
commit
87a3b25404
|
@ -1,4 +1,4 @@
|
|||
package overflow_grpc_pool
|
||||
package grpc_pool
|
||||
|
||||
const (
|
||||
// DefaultWriteTimeout is default value of Write Timeout
|
||||
|
|
4
pool.go
4
pool.go
|
@ -1,4 +1,4 @@
|
|||
package overflow_grpc_pool
|
||||
package grpc_pool
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
@ -95,7 +95,7 @@ func (p *pool) createInstance() error {
|
|||
return ErrPoolFull
|
||||
}
|
||||
|
||||
conn, i, err := p.ph.OnCreate()
|
||||
conn, i, err := p.ph.Dial()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package overflow_grpc_pool
|
||||
package grpc_pool
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package overflow_grpc_pool
|
||||
package grpc_pool
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
@ -13,30 +14,30 @@ type PoolHandlers struct {
|
|||
MaxCapacity int
|
||||
}
|
||||
|
||||
func (h *PoolHandlers) Dial() (*grpc.ClientConn, interface{}, error) {
|
||||
return nil, nil, nil
|
||||
func (ph *PoolHandlers) Dial() (*grpc.ClientConn, interface{}, error) {
|
||||
return nil, nil, fmt.Errorf("GRPC Pool: Dial method is not implemented")
|
||||
}
|
||||
|
||||
func (h *PoolHandlers) GetIdleTimeout() time.Duration {
|
||||
return h.IdleTimeout
|
||||
func (ph *PoolHandlers) GetIdleTimeout() time.Duration {
|
||||
return ph.IdleTimeout
|
||||
}
|
||||
func (h *PoolHandlers) GetMaxIdle() int {
|
||||
return h.MaxIdle
|
||||
func (ph *PoolHandlers) GetMaxIdle() int {
|
||||
return ph.MaxIdle
|
||||
}
|
||||
func (h *PoolHandlers) GetMaxCapacity() int {
|
||||
return h.MaxCapacity
|
||||
func (ph *PoolHandlers) GetMaxCapacity() int {
|
||||
return ph.MaxCapacity
|
||||
}
|
||||
|
||||
// Validate validates the configuration
|
||||
func (o *PoolHandlers) Validate() {
|
||||
if o.IdleTimeout < 0 {
|
||||
o.IdleTimeout = DefaultIdleTimeout
|
||||
func (ph *PoolHandlers) Validate() {
|
||||
if ph.IdleTimeout < 0 {
|
||||
ph.IdleTimeout = DefaultIdleTimeout
|
||||
}
|
||||
if o.MaxIdle < 0 {
|
||||
o.MaxIdle = DefaultMaxIdle
|
||||
if ph.MaxIdle < 0 {
|
||||
ph.MaxIdle = DefaultMaxIdle
|
||||
}
|
||||
if o.MaxCapacity <= 0 {
|
||||
o.MaxCapacity = DefaultMaxCapacity
|
||||
if ph.MaxCapacity <= 0 {
|
||||
ph.MaxCapacity = DefaultMaxCapacity
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user