mirror of https://github.com/Chocobozzz/PeerTube
Fix "Correctly save transaction with retries"
parent
89e3951587
commit
18f13f43ec
|
@ -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
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue