1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-10-02 01:53:00 +08:00
parent 2ff2758fc8
commit d6c78a28bd
2 changed files with 5 additions and 4 deletions

View File

@@ -7,13 +7,13 @@ const sleepUtils = require('../utils/sleepUtils');
// 数据库连接池 // 数据库连接池
dbUtils.create({ dbUtils.create({
database: "neteaseMusic", // 指定数据库 database: "neteaseMusic", // 指定数据库
connectionLimit: 10, // 设置数据库连接池数量 connectionLimit: global.connectionLimit || 10, // 设置数据库连接池数量
}); });
global.dbUtils = dbUtils; global.dbUtils = dbUtils;
console.log("global.useMysqlPool:", !!global.useMysqlPool); console.log("global.useMysqlPool:", !!global.useMysqlPool);
// 两次请求之间停顿时间 // 两次请求之间停顿时间
global.sleepTime = 100; global.sleepTime = 500;
// 引入utils // 引入utils
const songInfoUtils = require('./src/getInfo/songInfoUtils'); const songInfoUtils = require('./src/getInfo/songInfoUtils');
@@ -52,7 +52,7 @@ async function main() {
console.log(`删除脏数据 affectRows:`, affectRows1.affectedRows, affectRows2.affectedRows); console.log(`删除脏数据 affectRows:`, affectRows1.affectedRows, affectRows2.affectedRows);
await songInfoUtils.fetchAll(); await songInfoUtils.fetchAll();
await albumInfoUtils.fetchAll(); await albumInfoUtils.fetchAll({});
await artistInfoUtils.fetchAll(); await artistInfoUtils.fetchAll();
await lyricInfoUtils.fetchAll(); await lyricInfoUtils.fetchAll();
await sleepUtils.sleep(2000); await sleepUtils.sleep(2000);

View File

@@ -1,4 +1,5 @@
global.useMysqlPool = false; global.useMysqlPool = true;
global.connectionLimit = 2;
const neteaseMusic = require('./netease_music/index'); const neteaseMusic = require('./netease_music/index');
neteaseMusic.watch(); neteaseMusic.watch();
setInterval(neteaseMusic.watch, 5000); setInterval(neteaseMusic.watch, 5000);