兼容 node 12
This commit is contained in:
parent
de815fed87
commit
5877674187
@ -45,7 +45,7 @@ async function migrateIdsFromCheckToFetch(tableName, fieldName, insertSql = null
|
|||||||
// 从待检查表中删除
|
// 从待检查表中删除
|
||||||
if (ids.length > 0)
|
if (ids.length > 0)
|
||||||
await dbUtils.query(`DELETE FROM wait_check_${tableName} WHERE id IN ?`, [[ids]]);
|
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) {
|
} catch (e) {
|
||||||
console.error(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 result = await dbUtils.query(`SELECT \`value\` as count FROM analysis WHERE \`key\`='${sql.name}'`);
|
||||||
let sqlTimeSpent = Date.now() - sqlStartTime;
|
let sqlTimeSpent = Date.now() - sqlStartTime;
|
||||||
sqlsTimeSpent += sqlTimeSpent;
|
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]}`);
|
console.log(`query ${sql.name} finished.\tspend time: ${sqlTimeSpent}ms (${(sqlTimeSpent / 1000).toFixed(2)}s),\tcount: ${newWatchParam[sql.name]}`);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
@ -45,7 +45,14 @@ async function getRedirectUrl(url) {
|
|||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
// console.log(res.headers.location);
|
// console.log(res.headers.location);
|
||||||
resolve(res?.headers?.location);
|
|
||||||
|
// 兼容 node 12
|
||||||
|
// resolve(res?.headers?.location);
|
||||||
|
if (res && res.headers) {
|
||||||
|
resolve(res.headers.location);
|
||||||
|
} else {
|
||||||
|
resolve(undefined);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user