]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/upload.ts
object-storage: @aws-sdk/lib-storage for multipart (#4903)
[github/Chocobozzz/PeerTube.git] / server / helpers / upload.ts
index 030a6b7d547e48ea99e44fd3eaf9eea6cd4dc6d4..c94c7ab82d316065b6294030186607dda1ae5e1a 100644 (file)
@@ -1,6 +1,5 @@
-import { METAFILE_EXTNAME } from '@uploadx/core'
-import { remove } from 'fs-extra'
 import { join } from 'path'
+import { JobQueue } from '@server/lib/job-queue'
 import { RESUMABLE_UPLOAD_DIRECTORY } from '../initializers/constants'
 
 function getResumableUploadPath (filename?: string) {
@@ -9,13 +8,14 @@ function getResumableUploadPath (filename?: string) {
   return RESUMABLE_UPLOAD_DIRECTORY
 }
 
-function deleteResumableUploadMetaFile (filepath: string) {
-  return remove(filepath + METAFILE_EXTNAME)
+function scheduleDeleteResumableUploadMetaFile (filepath: string) {
+  const payload = { filepath }
+  JobQueue.Instance.createJob({ type: 'delete-resumable-upload-meta-file', payload }, { delay: 900 * 1000 }) // executed in 15 min
 }
 
 // ---------------------------------------------------------------------------
 
 export {
   getResumableUploadPath,
-  deleteResumableUploadMetaFile
+  scheduleDeleteResumableUploadMetaFile
 }