Commit 4a21e5bf authored by Vladimir Barsukov's avatar Vladimir Barsukov
Browse files

fix

parent 8666da65
...@@ -265,7 +265,9 @@ func (d *Pool) Start() { ...@@ -265,7 +265,9 @@ func (d *Pool) Start() {
} }
} }
d.srvMaster.Alive = d.ping(d.srvMaster) == nil if d.srvMaster != nil {
d.srvMaster.Alive = d.ping(d.srvMaster) == nil
}
time.Sleep(time.Second) time.Sleep(time.Second)
} }
...@@ -277,7 +279,7 @@ func (d *Pool) Stop() { ...@@ -277,7 +279,7 @@ func (d *Pool) Stop() {
} }
func (d *Pool) IsAlive() bool { func (d *Pool) IsAlive() bool {
return d.srvMaster.Alive return d.srvMaster != nil && d.srvMaster.Alive
} }
func (d *Pool) prepare(sql string, param map[string]any) string { func (d *Pool) prepare(sql string, param map[string]any) string {
......
...@@ -34,7 +34,11 @@ func (d *Pool) StatPool() []*Stat { ...@@ -34,7 +34,11 @@ func (d *Pool) StatPool() []*Stat {
out = append(out, d.stat(q)) out = append(out, d.stat(q))
} }
return append(out, d.stat(d.srvMaster)) if d.srvMaster != nil {
return append(out, d.stat(d.srvMaster))
}
return out
} }
func (d *Pool) StatPoolTotal() *Stat { func (d *Pool) StatPoolTotal() *Stat {
......
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