Fix "Correctly save transaction with retries"

pull/6527/head
Chocobozzz 2024-07-24 15:20:03 +02:00
parent 89e3951587
commit 18f13f43ec
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 3 additions and 1 deletions

View File

@ -76,11 +76,13 @@ function saveInTransactionWithRetries <T extends Pick<Model, 'save' | 'changed'>
return sequelizeTypescript.transaction(async transaction => {
try {
await model.save({ transaction })
} catch {
} catch (err) {
// Reinit changed keys
for (const key of changedKeys) {
model.changed(key as keyof Model, true)
}
throw err
}
})
})