npm upgrades && docs

This commit is contained in:
zadam
2023-10-24 00:13:20 +02:00
parent 494b240015
commit cc20d17bd2
8 changed files with 1156 additions and 490 deletions

View File

@@ -253,7 +253,7 @@ function wrap(query, func) {
const milliseconds = Date.now() - startTimestamp;
if (milliseconds >= 20) {
if (milliseconds >= 20 && !cls.isSlowQueryLoggingDisabled()) {
if (query.includes("WITH RECURSIVE")) {
log.info(`Slow recursive query took ${milliseconds}ms.`);
}
@@ -323,6 +323,19 @@ async function copyDatabase(targetFilePath) {
await dbConnection.backup(targetFilePath);
}
function disableSlowQueryLogging(cb) {
const orig = cls.isSlowQueryLoggingDisabled();
try {
cls.disableSlowQueryLogging(true);
return cb();
}
finally {
cls.disableSlowQueryLogging(orig);
}
}
module.exports = {
dbConnection,
insert,
@@ -395,7 +408,8 @@ module.exports = {
transactional,
upsert,
fillParamList,
copyDatabase
copyDatabase,
disableSlowQueryLogging
};
</code></pre>
</article>