Prevent "Cannot use same state" error

This commit is contained in:
Chocobozzz 2022-09-28 10:03:06 +02:00
parent 718fc07953
commit 690bad52e1
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 4 additions and 1 deletions

View File

@ -82,7 +82,10 @@ async function moveToExternalStorageState (options: {
if (pendingTranscode !== 0) return false
const previousVideoState = video.state
await video.setNewState(VideoState.TO_MOVE_TO_EXTERNAL_STORAGE, isNewVideo, transaction)
if (video.state !== VideoState.TO_MOVE_TO_EXTERNAL_STORAGE) {
await video.setNewState(VideoState.TO_MOVE_TO_EXTERNAL_STORAGE, isNewVideo, transaction)
}
logger.info('Creating external storage move job for video %s.', video.uuid, { tags: [ video.uuid ] })