assistant添加异常捕获,避免数据库死锁异常造成assistant中断
This commit is contained in:
		@@ -1,5 +1,7 @@
 | 
			
		||||
// 定时更新 wait 表
 | 
			
		||||
 | 
			
		||||
const sleepUtils = require("../../utils/sleepUtils");
 | 
			
		||||
 | 
			
		||||
// 计算数组差集 (a - b)
 | 
			
		||||
function getDiffSet(a, b) {
 | 
			
		||||
    // let a = [1, 2, 3];
 | 
			
		||||
@@ -45,11 +47,16 @@ async function migrateIdsFromCheckToFetch(tableName, fieldName, insertSql = null
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getPromise(tableName, fieldName, insertSql) {
 | 
			
		||||
    return new Promise(async function (resolve) {
 | 
			
		||||
        await migrateIdsFromCheckToFetch(tableName, fieldName, insertSql);
 | 
			
		||||
        resolve();
 | 
			
		||||
    });
 | 
			
		||||
async function getPromise(tableName, fieldName, insertSql) {
 | 
			
		||||
    try {
 | 
			
		||||
        return new Promise(async function (resolve) {
 | 
			
		||||
            await migrateIdsFromCheckToFetch(tableName, fieldName, insertSql);
 | 
			
		||||
            resolve();
 | 
			
		||||
        });
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
        console.error(e);
 | 
			
		||||
        await sleepUtils.sleep(10 * 1000);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
async function updateWaitTable() {
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ async function main(args) {
 | 
			
		||||
 | 
			
		||||
            case 'assistant':
 | 
			
		||||
                await assistantUtils.updateWaitTable();
 | 
			
		||||
                await sleepUtils.sleep(5000);
 | 
			
		||||
                await sleepUtils.sleep(10 * 1000);
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                console.log("utils参数不匹配,退出");
 | 
			
		||||
 
 | 
			
		||||
@@ -1,35 +1,29 @@
 | 
			
		||||
cd C:\Users\Coz\Desktop\tools\
 | 
			
		||||
cd /www/neteasemusic/tools
 | 
			
		||||
node index --utils song    --min 1800000000 --max 2000000000 --order DESC               #
 | 
			
		||||
node index --utils song    --min 1290000000 --max 1500000000 --order DESC               #
 | 
			
		||||
node index --utils song    --min 400000000  --max 1000000000 --order ASC                #
 | 
			
		||||
node index --utils song    --min 0          --max 400000000  --order ASC                #
 | 
			
		||||
#############################################################################################
 | 
			
		||||
node index --utils album   --min 134000000  --max 160000000                             #
 | 
			
		||||
node index --utils album   --min 0          --max 134000000                             #
 | 
			
		||||
#############################################################################################
 | 
			
		||||
node index --utils artist   								                            #
 | 
			
		||||
#############################################################################################
 | 
			
		||||
node index --utils comment --min 1800000000 --max 2000000000 --order DESC               #
 | 
			
		||||
node index --utils comment --min 1290000000 --max 1500000000 --order DESC               #
 | 
			
		||||
node index --utils comment --min 400000000  --max 1000000000 --order ASC                #
 | 
			
		||||
node index --utils comment --min 0          --max 400000000  --order ASC                #
 | 
			
		||||
#############################################################################################
 | 
			
		||||
node index --utils lyric   --min 1800000000 --max 2000000000                            #
 | 
			
		||||
node index --utils lyric   --min 400000000  --max 1000000000                            #
 | 
			
		||||
node index --utils lyric   --min 0          --max 400000000                             #
 | 
			
		||||
#############################################################################################
 | 
			
		||||
node index --utils playlist                                                             #
 | 
			
		||||
本地
 | 
			
		||||
auto.bat
 | 
			
		||||
 | 
			
		||||
windows服务器
 | 
			
		||||
cd C:\Users\Administrator\Desktop\tools\netease_music
 | 
			
		||||
node index --utils album --min 10000000 --limit 1000 --order asc
 | 
			
		||||
node index --utils album --limit 1000 --order desc
 | 
			
		||||
node index --utils artist --limit 1000 --order desc
 | 
			
		||||
node index --utils artist --min 30000000 --limit 1000 --order asc
 | 
			
		||||
 | 
			
		||||
linux服务器
 | 
			
		||||
cd /www/neteasemusic/tools
 | 
			
		||||
node index --utils album --min 70000000 --limit 1000
 | 
			
		||||
node index --utils album --min 80000000 --limit 1000
 | 
			
		||||
node index --utils album --min 90000000 --limit 1000
 | 
			
		||||
node index --utils album --min 100000000 --limit 1000
 | 
			
		||||
 | 
			
		||||
hifini
 | 
			
		||||
linux服务器
 | 
			
		||||
node index --limit 300,50
 | 
			
		||||
node index --limit 200,50
 | 
			
		||||
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
 | 
			
		||||
@@ -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 assistant
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
思路:
 | 
			
		||||
通过一首歌,查出对应的artist和album,然后顺藤摸瓜查出网易云的其他song, album, artist, lyric, comment等
 | 
			
		||||
 | 
			
		||||
@@ -50,8 +46,6 @@ node index --database neteasemusic_develop --utils assistant
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
后期:
 | 
			
		||||
爬取歌单playlist功能需要更新
 | 
			
		||||
 | 
			
		||||
删除song_playlist_relation表中rcmd_reason字段(全是空字符串)
 | 
			
		||||
 | 
			
		||||
歌单定时更新(rel表中添加一个del字段,先将歌单下面的全部置为删除状态,再插入的时候把已有歌曲的标记重新修改为正常状态)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user