Commit cd95eb12 authored by Vladimir Barsukov's avatar Vladimir Barsukov
Browse files

add IsAlive

parent 4a280852
...@@ -178,10 +178,8 @@ func (d *Pool) ping(q *conn) (err error) { ...@@ -178,10 +178,8 @@ func (d *Pool) ping(q *conn) (err error) {
var n any var n any
if err = d.qGet(q, &n, "SELECT 1"); err != nil { if err = d.qGet(q, &n, "SELECT 1"); err != nil {
d.logger.Printf("DB_PING_ERR: MODE: %v, HOST: %s, PORT: %d, ERR: %v", d.logger.Printf("DB_PING_ERR: SRV: %s; %v",
q.Mode.String(), q.ToString(),
q.Config().ConnConfig.Host,
q.Config().ConnConfig.Port,
err, err,
) )
} }
...@@ -247,6 +245,10 @@ func (d *Pool) Stop() { ...@@ -247,6 +245,10 @@ func (d *Pool) Stop() {
d.stop = true d.stop = true
} }
func (d *Pool) IsAlive() bool {
return 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 {
for n, t := range param { for n, t := range param {
switch t.(type) { switch t.(type) {
......
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