11901: Require management token for health checks.
[arvados.git] / services / ws / event_source.go
index 7c1b58492dd030ef6b579abe8b699d787a758cc2..6a308b3a62df3ac14c36d51ba8b08b7a7b7694f6 100644 (file)
@@ -242,6 +242,12 @@ func (ps *pgEventSource) DB() *sql.DB {
        return ps.db
 }
 
+func (ps *pgEventSource) DBHealth() error {
+       ctx, _ := context.WithDeadline(context.Background(), time.Now().Add(time.Second))
+       var i int
+       return ps.db.QueryRowContext(ctx, "SELECT 1").Scan(&i)
+}
+
 func (ps *pgEventSource) DebugStatus() interface{} {
        ps.mtx.Lock()
        defer ps.mtx.Unlock()