improced commit-rollback behaviour on multi-step transactions
Build Docker Image / Docker-Build (push) Successful in 2m56s
Build Docker Image / Clean-Registry (push) Successful in 8s

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-07-20 00:22:06 +02:00
parent 8d93dbfc11
commit d9f28e3b6c
7 changed files with 65 additions and 10 deletions
@@ -340,7 +340,6 @@ CREATE TABLE IF NOT EXISTS {0} (
var addQuery = replaceInto(TABLE_TASK_DEPENDENCIES, TASK_ID, REQUIRED_TASK_ID);
for (var reqId : task.requiredTasksIds()) addQuery.values(task.id(), reqId);
addQuery.execute(db).close();
db.setAutoCommit(true);
}
task.clean(REQUIRED_TASKS_IDS);
@@ -354,7 +353,14 @@ CREATE TABLE IF NOT EXISTS {0} (
}
return task;
} catch (SQLException e){
try {
db.rollback();
} catch (SQLException ignored){};
throw failedToStoreObject(task.name()).causedBy(e);
} finally {
try {
db.setAutoCommit(true);
} catch (SQLException ignored){};
}
}