reload note cache if transaction rollback is detected

This commit is contained in:
zadam 2021-04-14 22:57:45 +02:00
parent 197537b159
commit 4311834d75

View file

@ -238,13 +238,19 @@ function transactional(func) {
const ret = dbConnection.transaction(func).deferred(); const ret = dbConnection.transaction(func).deferred();
if (!dbConnection.inTransaction) { // i.e. transaction was really committed (and not just savepoint released) if (!dbConnection.inTransaction) { // i.e. transaction was really committed (and not just savepoint released)
require('./ws.js').sendTransactionEntityChangesToAllClients(); require('./ws').sendTransactionEntityChangesToAllClients();
} }
return ret; return ret;
} }
catch (e) { catch (e) {
cls.clearEntityChanges(); const entityChanges = cls.getAndClearEntityChanges();
if (entityChanges.length > 0) {
log.info("Transaction rollback dirtied the note cache, forcing reload.");
require('./note_cache/note_cache_loader').load();
}
throw e; throw e;
} }