1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

assistant添加异常捕获,避免数据库死锁异常造成assistant中断

This commit is contained in:
2022-10-29 17:17:07 +08:00
parent fae4db04a3
commit c02dcdf814
3 changed files with 40 additions and 39 deletions

View File

@@ -1,5 +1,7 @@
// 定时更新 wait 表 // 定时更新 wait 表
const sleepUtils = require("../../utils/sleepUtils");
// 计算数组差集 a - b // 计算数组差集 a - b
function getDiffSet(a, b) { function getDiffSet(a, b) {
// let a = [1, 2, 3]; // let a = [1, 2, 3];
@@ -45,11 +47,16 @@ async function migrateIdsFromCheckToFetch(tableName, fieldName, insertSql = null
} }
} }
function getPromise(tableName, fieldName, insertSql) { async function getPromise(tableName, fieldName, insertSql) {
return new Promise(async function (resolve) { try {
await migrateIdsFromCheckToFetch(tableName, fieldName, insertSql); return new Promise(async function (resolve) {
resolve(); await migrateIdsFromCheckToFetch(tableName, fieldName, insertSql);
}); resolve();
});
} catch (e) {
console.error(e);
await sleepUtils.sleep(10 * 1000);
}
} }
async function updateWaitTable() { async function updateWaitTable() {
await Promise.all([ await Promise.all([

View File

@@ -84,7 +84,7 @@ async function main(args) {
case 'assistant': case 'assistant':
await assistantUtils.updateWaitTable(); await assistantUtils.updateWaitTable();
await sleepUtils.sleep(5000); await sleepUtils.sleep(10 * 1000);
break; break;
default: default:
console.log("utils参数不匹配退出"); console.log("utils参数不匹配退出");

View File

@@ -1,35 +1,29 @@
cd C:\Users\Coz\Desktop\tools\ 本地
cd /www/neteasemusic/tools auto.bat
node index --utils song --min 1800000000 --max 2000000000 --order DESC #
node index --utils song --min 1290000000 --max 1500000000 --order DESC # windows服务器
node index --utils song --min 400000000 --max 1000000000 --order ASC # cd C:\Users\Administrator\Desktop\tools\netease_music
node index --utils song --min 0 --max 400000000 --order ASC # node index --utils album --min 10000000 --limit 1000 --order asc
############################################################################################# node index --utils album --limit 1000 --order desc
node index --utils album --min 134000000 --max 160000000 # node index --utils artist --limit 1000 --order desc
node index --utils album --min 0 --max 134000000 # node index --utils artist --min 30000000 --limit 1000 --order asc
#############################################################################################
node index --utils artist # linux服务器
############################################################################################# cd /www/neteasemusic/tools
node index --utils comment --min 1800000000 --max 2000000000 --order DESC # node index --utils album --min 70000000 --limit 1000
node index --utils comment --min 1290000000 --max 1500000000 --order DESC # node index --utils album --min 80000000 --limit 1000
node index --utils comment --min 400000000 --max 1000000000 --order ASC # node index --utils album --min 90000000 --limit 1000
node index --utils comment --min 0 --max 400000000 --order ASC # node index --utils album --min 100000000 --limit 1000
#############################################################################################
node index --utils lyric --min 1800000000 --max 2000000000 # hifini
node index --utils lyric --min 400000000 --max 1000000000 # linux服务器
node index --utils lyric --min 0 --max 400000000 # node index --limit 300,50
############################################################################################# node index --limit 200,50
node index --utils playlist # node index --limit 200,50 --order desc
Windows server
node index --limit 300,50 --order desc
正式库
node index --utils song
node index --utils album --min 10000000
node index --utils album --order desc
node index --utils artist
node index --utils playlist
node index --utils comment --limit 10000
node index --utils lyric
node index --utils assistant
本地库测试 本地库测试
node index --database neteasemusic_develop --utils song node index --database neteasemusic_develop --utils song
@@ -41,6 +35,8 @@ node index --database neteasemusic_develop --utils comment --limit 10000
node index --database neteasemusic_develop --utils lyric node index --database neteasemusic_develop --utils lyric
node index --database neteasemusic_develop --utils assistant node index --database neteasemusic_develop --utils assistant
思路: 思路:
通过一首歌查出对应的artist和album然后顺藤摸瓜查出网易云的其他song, album, artist, lyric, comment等 通过一首歌查出对应的artist和album然后顺藤摸瓜查出网易云的其他song, album, artist, lyric, comment等
@@ -50,8 +46,6 @@ node index --database neteasemusic_develop --utils assistant
后期: 后期:
爬取歌单playlist功能需要更新
删除song_playlist_relation表中rcmd_reason字段全是空字符串 删除song_playlist_relation表中rcmd_reason字段全是空字符串
歌单定时更新rel表中添加一个del字段先将歌单下面的全部置为删除状态再插入的时候把已有歌曲的标记重新修改为正常状态 歌单定时更新rel表中添加一个del字段先将歌单下面的全部置为删除状态再插入的时候把已有歌曲的标记重新修改为正常状态