mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
logging of slow queries (currently >= 200ms)
This commit is contained in:
parent
80178b52c0
commit
de14e808c7
@ -117,7 +117,16 @@ async function getColumn(query, params = []) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function execute(query, params = []) {
|
async function execute(query, params = []) {
|
||||||
return await wrap(async db => db.run(query, ...params));
|
const startTimestamp = Date.now();
|
||||||
|
|
||||||
|
const result = await wrap(async db => db.run(query, ...params));
|
||||||
|
|
||||||
|
const milliseconds = Date.now() - startTimestamp;
|
||||||
|
if (milliseconds >= 200) {
|
||||||
|
log.info(`Slow query took ${milliseconds}ms: ${query}, params=${params}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function executeScript(query) {
|
async function executeScript(query) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user