From 4565774669bc3c1b11cc726d577946953dbe53c5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Feb 2023 08:59:27 +0100 Subject: Fix retrying update on sql serialization conflict --- server/lib/activitypub/actors/updater.ts | 15 ++++----------- server/lib/activitypub/videos/updater.ts | 8 ++------ 2 files changed, 6 insertions(+), 17 deletions(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/actors/updater.ts b/server/lib/activitypub/actors/updater.ts index fe94af9f1..137980460 100644 --- a/server/lib/activitypub/actors/updater.ts +++ b/server/lib/activitypub/actors/updater.ts @@ -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 diff --git a/server/lib/activitypub/videos/updater.ts b/server/lib/activitypub/videos/updater.ts index 32cbf7e07..0bf32f440 100644 --- a/server/lib/activitypub/videos/updater.ts +++ b/server/lib/activitypub/videos/updater.ts @@ -13,8 +13,6 @@ export class APVideoUpdater extends APVideoAbstractBuilder { private readonly wasPrivateVideo: boolean private readonly wasUnlistedVideo: boolean - private readonly videoFieldsSave: any - private readonly oldVideoChannel: MChannelAccountLight protected lTags: LoggerTagsFn @@ -30,8 +28,6 @@ export class APVideoUpdater extends APVideoAbstractBuilder { this.oldVideoChannel = this.video.VideoChannel - this.videoFieldsSave = this.video.toJSON() - this.lTags = loggerTagsFactory('ap', 'video', 'update', video.uuid, video.url) } @@ -156,8 +152,8 @@ export class APVideoUpdater extends APVideoAbstractBuilder { } private catchUpdateError (err: Error) { - if (this.video !== undefined && this.videoFieldsSave !== undefined) { - resetSequelizeInstance(this.video, this.videoFieldsSave) + if (this.video !== undefined) { + resetSequelizeInstance(this.video) } // This is just a debug because we will retry the insert -- cgit v1.2.3