diff options
author | Chocobozzz <me@florianbigard.com> | 2023-02-14 08:59:27 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-02-14 09:03:22 +0100 |
commit | 4565774669bc3c1b11cc726d577946953dbe53c5 (patch) | |
tree | ee0e41e06245861a0de896684caa388f82cc3470 /server/helpers/database-utils.ts | |
parent | 4c61660a0ab6224079c67d8282b282772a0772e4 (diff) | |
download | PeerTube-4565774669bc3c1b11cc726d577946953dbe53c5.tar.gz PeerTube-4565774669bc3c1b11cc726d577946953dbe53c5.tar.zst PeerTube-4565774669bc3c1b11cc726d577946953dbe53c5.zip |
Fix retrying update on sql serialization conflict
Diffstat (limited to 'server/helpers/database-utils.ts')
-rw-r--r-- | server/helpers/database-utils.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts index 627381086..0e6b35503 100644 --- a/server/helpers/database-utils.ts +++ b/server/helpers/database-utils.ts | |||
@@ -78,10 +78,8 @@ function updateInstanceWithAnother <M, T extends U, U extends Model<M>> (instanc | |||
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | function resetSequelizeInstance (instance: Model<any>, savedFields: object) { | 81 | function resetSequelizeInstance <T> (instance: Model<T>) { |
82 | Object.keys(savedFields).forEach(key => { | 82 | instance.set(instance.previous()) |
83 | instance[key] = savedFields[key] | ||
84 | }) | ||
85 | } | 83 | } |
86 | 84 | ||
87 | function filterNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean }> ( | 85 | function filterNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean }> ( |