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) { | ||||
|     if (dbConnection.inTransaction) { | ||||
|         return func(); | ||||
|     } | ||||
|     const ret = dbConnection.transaction(func).deferred(); | ||||
|  | ||||
|     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(); | ||||
|  | ||||
|     return ret; | ||||
|     } | ||||
|     catch (e) { | ||||
|         if (dbConnection.inTransaction) { | ||||
|             rollback(); | ||||
|         } | ||||
|  | ||||
|         throw e; | ||||
|     } | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user