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);
|
const client = await setSurvey(projectId);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
transaction.begin(client);
|
||||||
|
|
||||||
const text = `
|
const text = `
|
||||||
UPDATE planned_lines
|
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 ];
|
const values = [ sequence, p.sequence, p.fsp, p.lsp, p.ts0, p.ts1, p.name, p.remarks, p.meta ];
|
||||||
|
|
||||||
await client.query(text, values);
|
await client.query(text, values);
|
||||||
|
|
||||||
|
transaction.commit(client);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
transaction.rollback(err);
|
transaction.rollback(client);
|
||||||
throw err;
|
throw err;
|
||||||
} finally {
|
} finally {
|
||||||
client.release();
|
client.release();
|
||||||
|
|||||||
Reference in New Issue
Block a user