Ping MySQL every minute in an attempt to keep the connection alive.

I've tried various MySQL server settings, and some TCP settings on the webtry server, none seem to keep the connection from hanging, so this is a brute-force solution.

BUG=skia:
R=mtklein@google.com

Author: jcgregorio@google.com

Review URL: https://codereview.chromium.org/286543003

git-svn-id: http://skia.googlecode.com/svn/trunk@14720 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-05-14 12:55:34 +00:00
parent ab885be21b
commit 9f3b925e76

View File

@ -235,6 +235,17 @@ func init() {
_, err = db.Exec(sql)
log.Printf("Info: status creating sqlite table for workspace try: %q\n", err)
}
// Ping the database to keep the connection fresh.
go func() {
c := time.Tick(1 * time.Minute)
for _ = range c {
if err := db.Ping(); err != nil {
log.Printf("ERROR: Database failed to respond: %q\n", err)
}
}
}()
}
// Titlebar is used in titlebar template expansion.