]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-caption.ts
Avoid concurrency issue on transcoding
[github/Chocobozzz/PeerTube.git] / server / models / video / video-caption.ts
index 5ec944b9e8042c4bc38a3288451d9953a2318bac..5fbcd6e3b9f278512ff3091b1e97dad8d01c1c8e 100644 (file)
@@ -15,9 +15,9 @@ import {
   Table,
   UpdatedAt
 } from 'sequelize-typescript'
-import { v4 as uuidv4 } from 'uuid'
 import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models'
-import { AttributesOnly } from '@shared/core-utils'
+import { buildUUID } from '@shared/extra-utils'
+import { AttributesOnly } from '@shared/typescript-utils'
 import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
 import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'
 import { logger } from '../../helpers/logger'
@@ -182,7 +182,7 @@ export class VideoCaptionModel extends Model<Partial<AttributesOnly<VideoCaption
   }
 
   static generateCaptionName (language: string) {
-    return `${uuidv4()}-${language}.vtt`
+    return `${buildUUID()}-${language}.vtt`
   }
 
   isOwned () {
@@ -195,7 +195,8 @@ export class VideoCaptionModel extends Model<Partial<AttributesOnly<VideoCaption
         id: this.language,
         label: VideoCaptionModel.getLanguageLabel(this.language)
       },
-      captionPath: this.getCaptionStaticPath()
+      captionPath: this.getCaptionStaticPath(),
+      updatedAt: this.updatedAt.toISOString()
     }
   }