]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Prevent "Cannot use same state" error
authorChocobozzz <me@florianbigard.com>
Wed, 28 Sep 2022 08:03:06 +0000 (10:03 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 28 Sep 2022 08:03:06 +0000 (10:03 +0200)
server/lib/video-state.ts

index 9ebbd76796a2e78b06ba7b41e55b3b10834f7335..893725d85012f674b96d7274574c66c2d37d26d5 100644 (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 ] })