Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: experimental/webtry/webtry.go

Issue 286543003: Ping mySQL every minute in an attempt to keep the connection alive. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/webtry/webtry.go
diff --git a/experimental/webtry/webtry.go b/experimental/webtry/webtry.go
index f909b0637d3a30d64f2dbd12fa154a339d9ae591..bf352fb13178b0573a4128365f8695a1ac255c19 100644
--- a/experimental/webtry/webtry.go
+++ b/experimental/webtry/webtry.go
@@ -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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698