mirror of https://github.com/Chocobozzz/PeerTube
Auto retry video state db query on failure
parent
5220859984
commit
4ddb53f65d
|
@ -9,6 +9,7 @@ import { VideoState } from '@shared/models'
|
|||
import { federateVideoIfNeeded } from './activitypub/videos'
|
||||
import { Notifier } from './notifier'
|
||||
import { addMoveToObjectStorageJob } from './video'
|
||||
import { retryTransactionWrapper } from '@server/helpers/database-utils'
|
||||
|
||||
function buildNextVideoState (currentState?: VideoState) {
|
||||
if (currentState === VideoState.PUBLISHED) {
|
||||
|
@ -41,6 +42,7 @@ function moveToNextState (options: {
|
|||
}) {
|
||||
const { video, previousVideoState, isNewVideo = true } = options
|
||||
|
||||
return retryTransactionWrapper(() => {
|
||||
return sequelizeTypescript.transaction(async t => {
|
||||
// Maybe the video changed in database, refresh it
|
||||
const videoDatabase = await VideoModel.loadFull(video.uuid, t)
|
||||
|
@ -62,6 +64,7 @@ function moveToNextState (options: {
|
|||
return moveToExternalStorageState({ video: videoDatabase, isNewVideo, transaction: t })
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async function moveToExternalStorageState (options: {
|
||||
|
|
Loading…
Reference in New Issue