Commit 7fd7ad91 authored by Vladimir Barsukov's avatar Vladimir Barsukov
Browse files

fix

parent 2235285a
......@@ -20,7 +20,6 @@ type Pool struct {
slavesIter *atomic.Int64
slavesAsyncIter *atomic.Int64
stop bool
Continues []string
ContinuesTry []string
TryOnError int
......@@ -45,7 +44,6 @@ func (d *Pool) WithContext(ctx context.Context) *Pool {
notAliveConns: d.notAliveConns,
slavesIter: d.slavesIter,
slavesAsyncIter: d.slavesAsyncIter,
stop: d.stop,
Continues: d.Continues,
ContinuesTry: d.ContinuesTry,
TryOnError: d.TryOnError,
......@@ -282,14 +280,9 @@ func (d *Pool) setNotAliveConn(conn *Conn) {
}
}
func (d *Pool) Start() {
d.stop = false
func (d *Pool) startPing() {
go func() {
for {
if d.stop {
return
}
rep:
for i, q := range d.notAliveConns {
......@@ -317,10 +310,6 @@ func (d *Pool) Start() {
}()
}
func (d *Pool) Stop() {
d.stop = true
}
func (d *Pool) IsAlive() bool {
return d.SrvMaster != nil && d.SrvMaster.Alive
}
......
......@@ -9,7 +9,7 @@ import (
)
func New(ctx context.Context) *Pool {
return &Pool{
p := &Pool{
ctx: ctx,
mu: &sync.RWMutex{},
slavesIter: &atomic.Int64{},
......@@ -21,6 +21,9 @@ func New(ctx context.Context) *Pool {
PingTimeout: time.Second * 5,
PingTry: 5,
}
p.startPing()
return p
}
func NewDefault() *Pool {
......@@ -33,7 +36,6 @@ func NewDefault() *Pool {
func NewMaster(conn string) *Pool {
s := NewDefault()
_ = s.NewConn(ConnModeMaster, conn)
s.Start()
return s
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment