Transaction error
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2022-10-11 14:28:14 +02:00
parent a4549a9f4e
commit d06492d367
1 changed files with 4 additions and 5 deletions

View File

@ -17,7 +17,6 @@ module.exports = Self => {
}); });
Self.deleteTrashFiles = async options => { Self.deleteTrashFiles = async options => {
const tx = await Self.beginTransaction({});
const myOptions = {}; const myOptions = {};
if (typeof options == 'object') if (typeof options == 'object')
@ -27,6 +26,7 @@ module.exports = Self => {
myOptions.transaction = tx; myOptions.transaction = tx;
try { try {
const tx = await Self.beginTransaction({});
if (process.env.NODE_ENV == 'test') if (process.env.NODE_ENV == 'test')
throw new UserError(`Action not allowed on the test environment`); throw new UserError(`Action not allowed on the test environment`);
@ -61,10 +61,9 @@ module.exports = Self => {
const dstFolder = path.join(dmsContainer.client.root, pathHash); const dstFolder = path.join(dmsContainer.client.root, pathHash);
try { try {
await fs.rmdir(dstFolder); await fs.rmdir(dstFolder);
} catch (err) {}
await dms.destroy(myOptions); await dms.destroy(myOptions);
} catch (err) {
await dms.destroy(myOptions);
}
} }
if (tx) await tx.commit(); if (tx) await tx.commit();
} catch (e) { } catch (e) {