1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Add timeout on youtube dl to cleaup files

This commit is contained in:
Chocobozzz 2018-10-01 12:00:05 +02:00
parent 2a27c451f7
commit cf9166cf2f
No known key found for this signature in database
GPG key ID: 583A612D890159BE
5 changed files with 30 additions and 17 deletions

View file

@ -6,7 +6,7 @@ import { VideoImportState } from '../../../../shared/models/videos'
import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils'
import { extname, join } from 'path'
import { VideoFileModel } from '../../../models/video/video-file'
import { CONFIG, sequelizeTypescript } from '../../../initializers'
import { CONFIG, sequelizeTypescript, VIDEO_IMPORT_TIMEOUT } from '../../../initializers'
import { doRequestAndSaveToFile } from '../../../helpers/requests'
import { VideoState } from '../../../../shared'
import { JobQueue } from '../index'
@ -65,7 +65,7 @@ async function processTorrentImport (job: Bull.Job, payload: VideoImportTorrentP
torrentName: videoImport.torrentName ? getSecureTorrentName(videoImport.torrentName) : undefined,
magnetUri: videoImport.magnetUri
}
return processFile(() => downloadWebTorrentVideo(target), videoImport, options)
return processFile(() => downloadWebTorrentVideo(target, VIDEO_IMPORT_TIMEOUT), videoImport, options)
}
async function processYoutubeDLImport (job: Bull.Job, payload: VideoImportYoutubeDLPayload) {
@ -83,7 +83,7 @@ async function processYoutubeDLImport (job: Bull.Job, payload: VideoImportYoutub
generatePreview: false
}
return processFile(() => downloadYoutubeDLVideo(videoImport.targetUrl), videoImport, options)
return processFile(() => downloadYoutubeDLVideo(videoImport.targetUrl, VIDEO_IMPORT_TIMEOUT), videoImport, options)
}
async function getVideoImportOrDie (videoImportId: number) {