mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:27:09 +00:00
Fix transaction handling
This commit is contained in:
@@ -4,6 +4,7 @@ async function patch (projectId, sequence, payload, opts = {}) {
|
||||
const client = await setSurvey(projectId);
|
||||
|
||||
try {
|
||||
transaction.begin(client);
|
||||
|
||||
const text = `
|
||||
UPDATE planned_lines
|
||||
@@ -23,8 +24,10 @@ async function patch (projectId, sequence, payload, opts = {}) {
|
||||
const values = [ sequence, p.sequence, p.fsp, p.lsp, p.ts0, p.ts1, p.name, p.remarks, p.meta ];
|
||||
|
||||
await client.query(text, values);
|
||||
|
||||
transaction.commit(client);
|
||||
} catch (err) {
|
||||
transaction.rollback(err);
|
||||
transaction.rollback(client);
|
||||
throw err;
|
||||
} finally {
|
||||
client.release();
|
||||
|
||||
Reference in New Issue
Block a user