-// ---------------------------------------------------------------------------
-
-function updateInstanceWithAnother <M, T extends U, U extends Model<M>> (instanceToUpdate: T, baseInstance: U) {
- const obj = baseInstance.toJSON()
-
- for (const key of Object.keys(obj)) {
- instanceToUpdate[key] = obj[key]
- }
+function saveInTransactionWithRetries <T extends Pick<Model, 'save'>> (model: T) {
+ return retryTransactionWrapper(() => {
+ return sequelizeTypescript.transaction(async transaction => {
+ await model.save({ transaction })
+ })
+ })