mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	logging of slow queries (currently >= 200ms)
This commit is contained in:
		| @@ -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) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user