mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 01:06:36 +01:00
npm upgrades && docs
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user