google-cloud-platform - Firebase Functions / Cloud SQL (mysql) / Knex 累积连接
问题描述
我们设置了 firebase 函数来连接到云 sql (mysql) 实例,除了与实例的连接没有池化之外,一切都按预期工作。我们发送到网站的连接越多,连接就会迅速攀升,直到达到 100 的限制。
lib/db.ts
import * as functions from 'firebase-functions';
import * as knex from 'knex';
const { env } = functions.config();
export default knex({
client: 'mysql',
connection: {
...env.mysql,
timezone: 'UTC',
dateStrings: true,
},
pool: { min: 1, max: 1 },
});
我们也在 main 中导入这个文件index.ts
import 'lib/db';
任何帮助,将不胜感激。
解决方案
推荐阅读
- discord - 如何添加前缀 discord.js
- python - Django - 如何从具有外键的模型中获取所有项目?
- mongodb - mongodb客户端的“无法读取未定义的属性'替换'”
- push-notification - 我需要创建一个不需要 FCM/GCM 或 APN 的需要推送通知的 Web 应用程序
- node.js - 在 MongoDB (Mongoose) 中使用事务创建链表
- c++ - 如何正确设置项目的 make 文件?
- amazon-web-services - 允许访问 Cognito 用户的 AWS S3 存储桶策略
- spring-boot - 如何使用 gradle 执行“spring-boot”项目中的所有测试用例?
- c++ - 如何在 C++ 中找到向量中的 Max 及其索引?
- java - Java中的清除导致空结果?