X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fupload.ts;h=c94c7ab82d316065b6294030186607dda1ae5e1a;hb=0628157fe9662fdb2b6fa658b8b53fe684c013ce;hp=030a6b7d547e48ea99e44fd3eaf9eea6cd4dc6d4;hpb=8f608a4cb22ab232cfab20665050764b38bac9c7;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/upload.ts b/server/helpers/upload.ts index 030a6b7d5..c94c7ab82 100644 --- a/server/helpers/upload.ts +++ b/server/helpers/upload.ts @@ -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 }