mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Optimize SQL requests of watch page API endpoints
This commit is contained in:
@@ -25,7 +25,7 @@ run()
|
||||
async function run () {
|
||||
await initDatabaseModels(true)
|
||||
|
||||
const video = await VideoModel.loadByUUID(program['video'])
|
||||
const video = await VideoModel.loadByUUIDWithFile(program['video'])
|
||||
if (!video) throw new Error('Video not found.')
|
||||
if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.')
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ run()
|
||||
async function run () {
|
||||
await initDatabaseModels(true)
|
||||
|
||||
const video = await VideoModel.loadByUUID(program['video'])
|
||||
const video = await VideoModel.loadByUUIDWithFile(program['video'])
|
||||
if (!video) throw new Error('Video not found.')
|
||||
|
||||
const dataInput = {
|
||||
|
||||
@@ -56,7 +56,7 @@ async function pruneDirectory (directory: string) {
|
||||
const uuid = getUUIDFromFilename(file)
|
||||
let video: VideoModel
|
||||
|
||||
if (uuid) video = await VideoModel.loadByUUID(uuid)
|
||||
if (uuid) video = await VideoModel.loadByUUIDWithFile(uuid)
|
||||
|
||||
if (!uuid || !video) toDelete.push(join(directory, file))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user