dbr*_*rrt 4 database pool node.js sequelize.js
目前我正在使用 NodeJS/TypeScript 在 Sequelize 之上设计一个应用程序,我想知道它是否会导致性能问题而不关闭连接。
例如,在微服务中,我需要来自 1 个实体的数据。
const resolver = async (,,{db}) => {
const entity1 = await db.models.Entity1.findOne()
return entity1
}
Run Code Online (Sandbox Code Playgroud)
调用后是否需要关闭连接findOne?
我的理解是,以下配置定义了多个并发连接,空闲是一个参数,使连接管理器关闭空闲连接的连接:
module.exports = {
development: {
host: 'db.sqlite',
dialect: 'sqlite',
pool: {
max:5,
min:0,
idle:10000
}
},
test: {
host: 'test.sqlite',
dialect: 'sqlite',
pool: {
max:5,
min:0,
idle:10000
}
}
}
Run Code Online (Sandbox Code Playgroud)
欢迎任何建议
| 归档时间: |
|
| 查看次数: |
11305 次 |
| 最近记录: |