Skip to content

Commit 3ce7ce4

Browse files
Check database connection in healthcheck
1 parent d1096fa commit 3ce7ce4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

cmd/janitor/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ func run(cmd *cobra.Command, args []string) {
8787

8888
// start HTTP server for Prometheus metrics and health check
8989
handler := httpapi.Compose(
90-
httpapi.HealthCheckAPI{SkipRequestLog: true},
90+
httpapi.HealthCheckAPI{
91+
SkipRequestLog: true,
92+
Check: func() error {
93+
return db.Db.PingContext(ctx)
94+
},
95+
},
9196
pprofapi.API{IsAuthorized: pprofapi.IsRequestFromLocalhost},
9297
)
9398
mux := http.NewServeMux()

0 commit comments

Comments
 (0)