From df6cca2fcbf5a9c157870123fdbfcd8cf88d4eda Mon Sep 17 00:00:00 2001 From: kiwiidb Date: Wed, 27 Sep 2023 14:38:57 +0200 Subject: [PATCH] add 30s timeout to startup context --- cmd/server/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index fa5a61a..73351cb 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -71,7 +71,8 @@ func main() { // Migrate the DB //Todo: use timeout for startupcontext - startupCtx := context.Background() + startupCtx, startupCancel := context.WithTimeout(context.Background(), 30*time.Second) + defer startupCancel() migrator := migrate.NewMigrator(dbConn, migrations.Migrations) err = migrator.Init(startupCtx) if err != nil {