|
经常遇到整个服务器卡死,系统盘读操作被占满,内存确是正常
补充一下,这个项目使用 bytenode 编译后文件在跑,不是源代码跑。
axios 也做了统一处理
const axios = require('axios');
const https = require('https');
// 全局 10 秒超时
axios.defaults.timeout = 10000;
// 创建自定义的 HTTPS 代理,限制连接数
const httpsAgent = new https.Agent({
keepAlive: true,
keepAliveMsecs: 30000,
maxSockets: 30, // 限制并发连接数
maxFreeSockets: 5, // 限制空闲连接数
timeout: 10000, // 连接超时
});
// 创建 axios 实例
const apiClient = axios.create({
httpsAgent: httpsAgent,
timeout: 10000, // 请求超时
maxRedirects: 3,
});
module.exports = apiClient
有没有大佬能出出主意,到底是哪里出问题了?
|