🔧 Tweaking the import queue call

This commit is contained in:
2022-04-18 16:02:34 -07:00
parent 1519058a02
commit e7e230503e

View File

@@ -58,7 +58,7 @@ export default class QueueService extends Service {
hooks: {}, hooks: {},
queues: { queues: {
"process.import": { "process.import": {
concurrency: 1, concurrency: 20,
async process(job: SandboxedJob) { async process(job: SandboxedJob) {
console.info("New job received!", job.data); console.info("New job received!", job.data);
console.info(`Processing queue...`); console.info(`Processing queue...`);
@@ -89,24 +89,38 @@ export default class QueueService extends Service {
// write to mongo // write to mongo
console.log("Writing to mongo..."); console.log("Writing to mongo...");
const dbImportResult = await this.broker.call( await this.broker.call("library.rawImportToDB", {
"library.rawImportToDB", importStatus: {
{ isImported: true,
importStatus: { tagged: false,
isImported: true, matchedResult: {
tagged: false, score: "0",
matchedResult: {
score: "0",
},
},
rawFileDetails: {
name,
filePath,
fileSize: job.data.fileObject.fileSize,
extension,
containedIn,
cover,
}, },
},
rawFileDetails: {
name,
filePath,
fileSize: job.data.fileObject.fileSize,
extension,
containedIn,
cover,
},
inferredMetadata: {
issue: inferredIssueDetails,
},
sourcedMetadata: {
comicInfo: comicInfoJSON,
comicvine: {},
},
// since we already have at least 1 copy
// mark it as not wanted by default
acquisition: {
wanted: false,
},
});
return {
data: {
result,
inferredMetadata: { inferredMetadata: {
issue: inferredIssueDetails, issue: inferredIssueDetails,
}, },
@@ -114,16 +128,7 @@ export default class QueueService extends Service {
comicInfo: comicInfoJSON, comicInfo: comicInfoJSON,
comicvine: {}, comicvine: {},
}, },
// since we already have at least 1 copy },
// mark it as not wanted by default
acquisition: {
wanted: false,
},
}
);
console.log("JAMA", dbImportResult);
return {
dbImportResult,
id: job.id, id: job.id,
worker: process.pid, worker: process.pid,
}; };