兼容 node 12
This commit is contained in:
		@@ -45,7 +45,7 @@ async function migrateIdsFromCheckToFetch(tableName, fieldName, insertSql = null
 | 
			
		||||
            // 从待检查表中删除
 | 
			
		||||
            if (ids.length > 0)
 | 
			
		||||
                await dbUtils.query(`DELETE FROM wait_check_${tableName} WHERE id IN ?`, [[ids]]);
 | 
			
		||||
            console.log(`table: ${tableName}\t| ${fill(ids[0], 10)} - ${fill(ids.slice(-1)[0], 10)} ${fill(`(${finalIds.length}/${ids.length})`, 10, ' ', true)}\t| affected: ${result?.affectedRows}`);
 | 
			
		||||
            console.log(`table: ${tableName}\t| ${fill(ids[0], 10)} - ${fill(ids.slice(-1)[0], 10)} ${fill(`(${finalIds.length}/${ids.length})`, 10, ' ', true)}\t| affected: ${result ? result.affectedRows : ""}`);
 | 
			
		||||
        }
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
        console.error(e);
 | 
			
		||||
 
 | 
			
		||||
@@ -175,7 +175,7 @@ async function watch() {
 | 
			
		||||
            let result = await dbUtils.query(`SELECT \`value\` as count FROM analysis WHERE \`key\`='${sql.name}'`);
 | 
			
		||||
            let sqlTimeSpent = Date.now() - sqlStartTime;
 | 
			
		||||
            sqlsTimeSpent += sqlTimeSpent;
 | 
			
		||||
            newWatchParam[sql.name] = result[0]?.count;
 | 
			
		||||
            newWatchParam[sql.name] = result ? result[0].count : undefined; // result[0]?.count  兼容 node 12
 | 
			
		||||
            console.log(`query ${sql.name} finished.\tspend time: ${sqlTimeSpent}ms (${(sqlTimeSpent / 1000).toFixed(2)}s),\tcount: ${newWatchParam[sql.name]}`);
 | 
			
		||||
            resolve();
 | 
			
		||||
        }));
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user