我使用了TypeScript和NestJS
我想配置连接池超过10个。
但总是最大连接10.
// My Typeorm config
import { TypeOrmModuleOptions } from '@nestjs/typeorm'
import * as dotenv from 'dotenv'
import { SnakeNamingStrategy } from 'typeorm-naming-strategies'
const config: TypeOrmModuleOptions = {
type: 'postgres',
host: process.env.POSTGRES_HOST,
port: parseInt(process.env.POSTGRES_PORT || '5432'),
username: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASS,
database: process.env.POSTGRES_DATABASE,
entities: ['src/**/*.entity{.ts,.js}'],
namingStrategy: new SnakeNamingStrategy(),
migrationsTableName: 'migration',
migrations: ['src/db/migrations/*.ts'],
cli: {
migrationsDir: 'src/db/migrations',
},
extra: {
max: 30
}
}
export default config
字符串
我应该做什么postgres连接超过10?
1条答案
按热度按时间wfsdck301#
您需要调整poolSize,下面的示例将其调整为20。
字符串
来源:https://typeorm.io/data-source-options#common-data-source-options