mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
Fix "Correctly save transaction with retries"
This commit is contained in:
parent
89e3951587
commit
18f13f43ec
1 changed files with 3 additions and 1 deletions
|
@ -76,11 +76,13 @@ function saveInTransactionWithRetries <T extends Pick<Model, 'save' | 'changed'>
|
||||||
return sequelizeTypescript.transaction(async transaction => {
|
return sequelizeTypescript.transaction(async transaction => {
|
||||||
try {
|
try {
|
||||||
await model.save({ transaction })
|
await model.save({ transaction })
|
||||||
} catch {
|
} catch (err) {
|
||||||
// Reinit changed keys
|
// Reinit changed keys
|
||||||
for (const key of changedKeys) {
|
for (const key of changedKeys) {
|
||||||
model.changed(key as keyof Model, true)
|
model.changed(key as keyof Model, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw err
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue