fix(medusa): Race condition in cart completion strategy (#2341)
This commit is contained in:
1 parent
94eb2bfc02
commit
5908d9b9b6
1 file changed
+6
@@ -328,9 +328,15 @@ class CartCompletionStrategy extends AbstractCartCompletionStrategy {
|
|||||||
if (err) {
|
if (err) {
|
||||||
if (idempotencyKey.recovery_point !== "started") {
|
if (idempotencyKey.recovery_point !== "started") {
|
||||||
await this.manager_.transaction(async (transactionManager) => {
|
await this.manager_.transaction(async (transactionManager) => {
|
||||||
|
try {
|
||||||
|
await orderService
|
||||||
|
.withTransaction(transactionManager)
|
||||||
|
.retrieveByCartId(id)
|
||||||
|
} catch (error) {
|
||||||
await cartService
|
await cartService
|
||||||
.withTransaction(transactionManager)
|
.withTransaction(transactionManager)
|
||||||
.deleteTaxLines(id)
|
.deleteTaxLines(id)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
throw err
|
throw err
|
||||||
|
|||||||
Reference in new issue
Block a user