diff --git a/go-runtime/ftl/database.go b/go-runtime/ftl/database.go index d0d4a18fb6..c0c6717654 100644 --- a/go-runtime/ftl/database.go +++ b/go-runtime/ftl/database.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "fmt" + "time" "github.com/XSAM/otelsql" "github.com/alecthomas/types/once" @@ -47,6 +48,8 @@ func PostgresDatabase(name string) Database { if err != nil { return nil, fmt.Errorf("failed to register database metrics: %w", err) } + db.SetConnMaxIdleTime(time.Minute) + db.SetMaxOpenConns(20) return db, nil }), }