mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08: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
	 azivner
						azivner