diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-10-25 17:42:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-25 17:42:20 +0200 |
commit | 276250f0a36e00373166d91d539e5220d6f158c7 (patch) | |
tree | 394e4fd65912edbbe9266ccfbacfc14f433371e7 /server/helpers | |
parent | b2ad0090c182c7f2a8cba1cced3987d408a4b159 (diff) | |
download | PeerTube-276250f0a36e00373166d91d539e5220d6f158c7.tar.gz PeerTube-276250f0a36e00373166d91d539e5220d6f158c7.tar.zst PeerTube-276250f0a36e00373166d91d539e5220d6f158c7.zip |
prevent multiple post-process triggering of upload-resumable (#4175)
* prevent multiple post-process triggering of upload-resumable
* switch from 409 to 503 for upload being processed
* Improve resumable upload check
Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/upload.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/helpers/upload.ts b/server/helpers/upload.ts index 3cb17edd0..c94c7ab82 100644 --- a/server/helpers/upload.ts +++ b/server/helpers/upload.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { join } from 'path' | 1 | import { join } from 'path' |
2 | import { JobQueue } from '@server/lib/job-queue' | ||
2 | import { RESUMABLE_UPLOAD_DIRECTORY } from '../initializers/constants' | 3 | import { RESUMABLE_UPLOAD_DIRECTORY } from '../initializers/constants' |
3 | 4 | ||
4 | function getResumableUploadPath (filename?: string) { | 5 | function getResumableUploadPath (filename?: string) { |
@@ -7,8 +8,14 @@ function getResumableUploadPath (filename?: string) { | |||
7 | return RESUMABLE_UPLOAD_DIRECTORY | 8 | return RESUMABLE_UPLOAD_DIRECTORY |
8 | } | 9 | } |
9 | 10 | ||
11 | function scheduleDeleteResumableUploadMetaFile (filepath: string) { | ||
12 | const payload = { filepath } | ||
13 | JobQueue.Instance.createJob({ type: 'delete-resumable-upload-meta-file', payload }, { delay: 900 * 1000 }) // executed in 15 min | ||
14 | } | ||
15 | |||
10 | // --------------------------------------------------------------------------- | 16 | // --------------------------------------------------------------------------- |
11 | 17 | ||
12 | export { | 18 | export { |
13 | getResumableUploadPath | 19 | getResumableUploadPath, |
20 | scheduleDeleteResumableUploadMetaFile | ||
14 | } | 21 | } |