aboutsummaryrefslogtreecommitdiff
path: root/internal/database/database.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2020-09-04 09:58:08 -0400
committerJonathan Amsterdam <jba@google.com>2020-09-11 22:16:16 +0000
commit2f89a00a45a438e962e362238dcdd1987a8254b6 (patch)
tree4a95d2683f62ad5162c8e092853ee70cf2477d82 /internal/database/database.go
parent4be2e9ddc13f0f7ce5dc1a0facc46dbf258dc5b4 (diff)
downloadgo-x-pkgsite-2f89a00a45a438e962e362238dcdd1987a8254b6.tar.xz
internal/worker: add health check endpoint
This will be used with GKE health checks. The health checks hit "/" by default, which causes unnecessary work. Change-Id: I6093e5985102153bbabeb19feebbae1a44d55a9f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254378 Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/database/database.go')
-rw-r--r--internal/database/database.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/database/database.go b/internal/database/database.go
index fa82e6ce..bff5b08c 100644
--- a/internal/database/database.go
+++ b/internal/database/database.go
@@ -55,6 +55,10 @@ func New(db *sql.DB, instanceID string) *DB {
return &DB{db: db, instanceID: instanceID}
}
+func (db *DB) Ping() error {
+ return db.db.Ping()
+}
+
func (db *DB) InTransaction() bool {
return db.tx != nil
}