From d9dd51aec75d59bd322e249ae1c3ae98277957d3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 9 Sep 2022 12:05:35 +0200 Subject: Try playlist rebuild transaction if needed --- server/lib/activitypub/playlists/create-update.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/playlists/create-update.ts b/server/lib/activitypub/playlists/create-update.ts index c28700be6..9339e8ea4 100644 --- a/server/lib/activitypub/playlists/create-update.ts +++ b/server/lib/activitypub/playlists/create-update.ts @@ -1,5 +1,6 @@ import { map } from 'bluebird' import { isArray } from '@server/helpers/custom-validators/misc' +import { retryTransactionWrapper } from '@server/helpers/database-utils' import { logger, loggerTagsFactory } from '@server/helpers/logger' import { CRAWL_REQUEST_CONCURRENCY } from '@server/initializers/constants' import { sequelizeTypescript } from '@server/initializers/database' @@ -124,13 +125,13 @@ async function updatePlaylistThumbnail (playlistObject: PlaylistObject, playlist async function rebuildVideoPlaylistElements (elementUrls: string[], playlist: MVideoPlaylist) { const elementsToCreate = await buildElementsDBAttributes(elementUrls, playlist) - await sequelizeTypescript.transaction(async t => { + await retryTransactionWrapper(() => sequelizeTypescript.transaction(async t => { await VideoPlaylistElementModel.deleteAllOf(playlist.id, t) for (const element of elementsToCreate) { await VideoPlaylistElementModel.create(element, { transaction: t }) } - }) + })) logger.info('Rebuilt playlist %s with %s elements.', playlist.url, elementsToCreate.length, lTags(playlist.uuid, playlist.url)) -- cgit v1.2.3