]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/actors/updater.ts
Fix retrying update on sql serialization conflict
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / actors / updater.ts
index fe94af9f1120da0aaa524a970afba66804b3e433..1379804606439b3b623ff59a96e90a3b786a068b 100644 (file)
@@ -13,19 +13,12 @@ export class APActorUpdater {
 
   private accountOrChannel: MAccount | MChannel
 
-  private readonly actorFieldsSave: object
-  private readonly accountOrChannelFieldsSave: object
-
   constructor (
     private readonly actorObject: ActivityPubActor,
     private readonly actor: MActorFull
   ) {
-    this.actorFieldsSave = this.actor.toJSON()
-
     if (this.actorObject.type === 'Group') this.accountOrChannel = this.actor.VideoChannel
     else this.accountOrChannel = this.actor.Account
-
-    this.accountOrChannelFieldsSave = this.accountOrChannel.toJSON()
   }
 
   async update () {
@@ -58,12 +51,12 @@ export class APActorUpdater {
 
       logger.info('Remote account %s updated', this.actorObject.url)
     } catch (err) {
-      if (this.actor !== undefined && this.actorFieldsSave !== undefined) {
-        resetSequelizeInstance(this.actor, this.actorFieldsSave)
+      if (this.actor !== undefined) {
+        resetSequelizeInstance(this.actor)
       }
 
-      if (this.accountOrChannel !== undefined && this.accountOrChannelFieldsSave !== undefined) {
-        resetSequelizeInstance(this.accountOrChannel, this.accountOrChannelFieldsSave)
+      if (this.accountOrChannel !== undefined) {
+        resetSequelizeInstance(this.accountOrChannel)
       }
 
       // This is just a debug because we will retry the insert