2
0

WaitForNotification detects lost connections quicker

Ping server every 15 seconds while waiting if no traffic has occurred.
This commit is contained in:
Jack Christensen
2014-09-27 13:38:01 -05:00
parent d5e170cc0f
commit 5edd660971
2 changed files with 51 additions and 3 deletions
+2 -1
View File
@@ -357,7 +357,8 @@ func (rows *Rows) Values() ([]interface{}, error) {
// be returned in an error state. So it is allowed to ignore the error returned
// from Query and handle it in *Rows.
func (c *Conn) Query(sql string, args ...interface{}) (*Rows, error) {
rows := &Rows{conn: c, startTime: time.Now(), sql: sql, args: args, logger: c.logger}
c.lastActivityTime = time.Now()
rows := &Rows{conn: c, startTime: c.lastActivityTime, sql: sql, args: args, logger: c.logger}
ps, ok := c.preparedStatements[sql]
if !ok {