aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/database-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-02-14 08:59:27 +0100
committerChocobozzz <me@florianbigard.com>2023-02-14 09:03:22 +0100
commit4565774669bc3c1b11cc726d577946953dbe53c5 (patch)
treeee0e41e06245861a0de896684caa388f82cc3470 /server/helpers/database-utils.ts
parent4c61660a0ab6224079c67d8282b282772a0772e4 (diff)
downloadPeerTube-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.ts6
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
81function resetSequelizeInstance (instance: Model<any>, savedFields: object) { 81function 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
87function filterNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean }> ( 85function filterNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean }> (