use new queue

This commit is contained in:
SrGooglo 2025-02-25 23:09:38 +00:00
parent adbf694222
commit 61ba0670f2
3 changed files with 22 additions and 13 deletions

View File

@ -30,9 +30,12 @@ class API extends Server {
limits: {}, limits: {},
} }
queuesManager = new TaskQueueManager({ queuesManager = new TaskQueueManager(
workersPath: `${__dirname}/queues`, {
}) workersPath: `${__dirname}/queues`,
},
this,
)
async onInitialize() { async onInitialize() {
global.sse = this.contexts.SSEManager global.sse = this.contexts.SSEManager

View File

@ -29,7 +29,7 @@ export default {
transmuxOptions: transmuxOptions, transmuxOptions: transmuxOptions,
cachePath: cachePath, cachePath: cachePath,
onProgress: (progress) => { onProgress: (progress) => {
job.progress(progress) job.updateProgress(progress)
}, },
}) })

View File

@ -60,15 +60,21 @@ export default {
if (req.headers["transmux"] || limits.useCompression === true) { if (req.headers["transmux"] || limits.useCompression === true) {
// add a background task // add a background task
const job = await global.queues.createJob("remote_upload", { const job = await global.queues.createJob(
filePath: build.filePath, "remote_upload",
parentDir: req.auth.session.user_id, {
service: limits.useProvider, filePath: build.filePath,
useCompression: limits.useCompression, parentDir: req.auth.session.user_id,
transmux: req.headers["transmux"] ?? false, service: limits.useProvider,
transmuxOptions: req.headers["transmux-options"], useCompression: limits.useCompression,
cachePath: tmpPath, transmux: req.headers["transmux"] ?? false,
}) transmuxOptions: req.headers["transmux-options"],
cachePath: tmpPath,
},
{
useSSE: true,
},
)
const sseChannelId = job.sseChannelId const sseChannelId = job.sseChannelId