1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 01:39:37 +02:00

Fix legacy upload req timeout

This commit is contained in:
Chocobozzz 2024-06-24 09:10:11 +02:00
parent 05d84f659d
commit 209043e2d4
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 22 additions and 11 deletions

View file

@ -17,6 +17,7 @@ import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
authenticate,
setReqTimeout,
videosAddLegacyValidator,
videosAddResumableInitValidator,
videosAddResumableValidator
@ -40,6 +41,7 @@ const reqVideoFileAddResumable = createReqFiles(
uploadRouter.post('/upload',
openapiOperationDoc({ operationId: 'uploadLegacy' }),
authenticate,
setReqTimeout(1000 * 60 * 10), // Uploading the video could be long
reqVideoFileAdd,
asyncMiddleware(videosAddLegacyValidator),
asyncRetryTransactionMiddleware(addVideoLegacy)
@ -74,17 +76,7 @@ export {
// ---------------------------------------------------------------------------
async function addVideoLegacy (req: express.Request, res: express.Response) {
// Uploading the video could be long
// Set timeout to 10 minutes, as Express's default is 2 minutes
req.setTimeout(1000 * 60 * 10, () => {
logger.error('Video upload has timed out.')
return res.fail({
status: HttpStatusCode.REQUEST_TIMEOUT_408,
message: 'Video upload has timed out.'
})
})
const videoPhysicalFile = req.files['videofile'][0]
const videoPhysicalFile = req.files['videofile'][0]
const videoInfo: VideoCreate = req.body
const files = req.files