diff options
Diffstat (limited to 'server/lib/transcoding/transcoding.ts')
-rw-r--r-- | server/lib/transcoding/transcoding.ts | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/server/lib/transcoding/transcoding.ts b/server/lib/transcoding/transcoding.ts index 9a15f8613..b64ce6e1f 100644 --- a/server/lib/transcoding/transcoding.ts +++ b/server/lib/transcoding/transcoding.ts | |||
@@ -29,6 +29,8 @@ import { | |||
29 | } from '../paths' | 29 | } from '../paths' |
30 | import { VideoPathManager } from '../video-path-manager' | 30 | import { VideoPathManager } from '../video-path-manager' |
31 | import { VideoTranscodingProfilesManager } from './default-transcoding-profiles' | 31 | import { VideoTranscodingProfilesManager } from './default-transcoding-profiles' |
32 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | ||
33 | import { sequelizeTypescript } from '@server/initializers/database' | ||
32 | 34 | ||
33 | /** | 35 | /** |
34 | * | 36 | * |
@@ -309,22 +311,28 @@ async function generateHlsPlaylistCommon (options: { | |||
309 | await transcodeVOD(transcodeOptions) | 311 | await transcodeVOD(transcodeOptions) |
310 | 312 | ||
311 | // Create or update the playlist | 313 | // Create or update the playlist |
312 | const playlist = await VideoStreamingPlaylistModel.loadOrGenerate(video) | 314 | const playlist = await retryTransactionWrapper(() => { |
315 | return sequelizeTypescript.transaction(async transaction => { | ||
316 | const playlist = await VideoStreamingPlaylistModel.loadOrGenerate(video, transaction) | ||
313 | 317 | ||
314 | if (!playlist.playlistFilename) { | 318 | if (!playlist.playlistFilename) { |
315 | playlist.playlistFilename = generateHLSMasterPlaylistFilename(video.isLive) | 319 | playlist.playlistFilename = generateHLSMasterPlaylistFilename(video.isLive) |
316 | } | 320 | } |
317 | 321 | ||
318 | if (!playlist.segmentsSha256Filename) { | 322 | if (!playlist.segmentsSha256Filename) { |
319 | playlist.segmentsSha256Filename = generateHlsSha256SegmentsFilename(video.isLive) | 323 | playlist.segmentsSha256Filename = generateHlsSha256SegmentsFilename(video.isLive) |
320 | } | 324 | } |
321 | 325 | ||
322 | playlist.p2pMediaLoaderInfohashes = [] | 326 | playlist.p2pMediaLoaderInfohashes = [] |
323 | playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION | 327 | playlist.p2pMediaLoaderPeerVersion = P2P_MEDIA_LOADER_PEER_VERSION |
324 | 328 | ||
325 | playlist.type = VideoStreamingPlaylistType.HLS | 329 | playlist.type = VideoStreamingPlaylistType.HLS |
326 | 330 | ||
327 | await playlist.save() | 331 | await playlist.save({ transaction }) |
332 | |||
333 | return playlist | ||
334 | }) | ||
335 | }) | ||
328 | 336 | ||
329 | // Build the new playlist file | 337 | // Build the new playlist file |
330 | const extname = extnameUtil(videoFilename) | 338 | const extname = extnameUtil(videoFilename) |