From b7b42e832ad711ebb5af5c03e1c8e8a471c6bde0 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 25 Mar 2024 18:05:14 +0100 Subject: [feature] Add healthcheck endpoints `/livez` and `/readyz` (#2783) * [feature] Add healthcheck endpoints `/livez` and `/readyz` * use select that returns no data --- internal/db/bundb/basic.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'internal/db/bundb/basic.go') diff --git a/internal/db/bundb/basic.go b/internal/db/bundb/basic.go index 7b523f309..82212fc42 100644 --- a/internal/db/bundb/basic.go +++ b/internal/db/bundb/basic.go @@ -124,8 +124,14 @@ func (b *basicDB) DropTable(ctx context.Context, i interface{}) error { return err } -func (b *basicDB) IsHealthy(ctx context.Context) error { - return b.db.PingContext(ctx) +func (b *basicDB) Ready(ctx context.Context) error { + if _, err := b.db. + NewRaw("SELECT NULL FROM ? LIMIT 0", bun.Ident("instances")). + Exec(ctx); err != nil { + return err + } + + return nil } func (b *basicDB) Close() error { -- cgit v1.2.3