]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video.ts
Try to speed up AP update transaction
[github/Chocobozzz/PeerTube.git] / server / models / video / video.ts
index 749ef7197105bcb059bae197a8d9635e5ae6b00c..44aaa24efe3b02c55185b12fc512249e6deb5595 100644 (file)
@@ -1004,18 +1004,19 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
     })
   }
 
-  static async listPublishedLiveIds () {
+  static async listPublishedLiveUUIDs () {
     const options = {
-      attributes: [ 'id' ],
+      attributes: [ 'uuid' ],
       where: {
         isLive: true,
+        remote: false,
         state: VideoState.PUBLISHED
       }
     }
 
     const result = await VideoModel.findAll(options)
 
-    return result.map(v => v.id)
+    return result.map(v => v.uuid)
   }
 
   static listUserVideosForApi (options: {
@@ -1885,7 +1886,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
     return Array.isArray(this.VideoFiles) === true && this.VideoFiles.length !== 0
   }
 
-  async addAndSaveThumbnail (thumbnail: MThumbnail, transaction: Transaction) {
+  async addAndSaveThumbnail (thumbnail: MThumbnail, transaction?: Transaction) {
     thumbnail.videoId = this.id
 
     const savedThumbnail = await thumbnail.save({ transaction })
@@ -1919,7 +1920,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
   }
 
   getWatchStaticPath () {
-    return '/videos/watch/' + this.uuid
+    return '/w/' + this.uuid
   }
 
   getEmbedStaticPath () {