mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	further simplification - now using better-sqlite3 native transaction API
This commit is contained in:
		| @@ -211,29 +211,11 @@ function wrap(query, func) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function transactional(func) { | function transactional(func) { | ||||||
|     if (dbConnection.inTransaction) { |     const ret = dbConnection.transaction(func).deferred(); | ||||||
|         return func(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     try { |  | ||||||
|         beginTransaction(); |  | ||||||
|  |  | ||||||
|         const ret = func(); |  | ||||||
|  |  | ||||||
|         commit(); |  | ||||||
|  |  | ||||||
|         // note that sync rows sent from this action will be sent again by scheduled periodic ping |  | ||||||
|     require('./ws.js').sendPingToAllClients(); |     require('./ws.js').sendPingToAllClients(); | ||||||
|  |  | ||||||
|     return ret; |     return ret; | ||||||
|     } |  | ||||||
|     catch (e) { |  | ||||||
|         if (dbConnection.inTransaction) { |  | ||||||
|             rollback(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         throw e; |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| module.exports = { | module.exports = { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user