Skip to content

Commit

Permalink
Image file now gets deleted after committing transaction in temp/dele…
Browse files Browse the repository at this point in the history
…teimage
  • Loading branch information
Sebastian-Webster committed Oct 18, 2023
1 parent 21cfbc5 commit 5e19cf3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/Temp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1643,9 +1643,9 @@ class TempController {
], {session}),
Comment.deleteMany({postId: {$eq: postId}, postFormat: "Image"}, {session})
]).then(() => {
imageHandler.deleteImageByKey(data.imageKey)

session.commitTransaction().then(() => {
imageHandler.deleteImageByKey(data.imageKey)

session.endSession().catch(error => {
console.error('An error occurred while ending Mongoose session:', error)
}).finally(() => {
Expand Down

0 comments on commit 5e19cf3

Please sign in to comment.