✏️ Renamed queue service and refactored

This commit is contained in:
2022-03-29 12:03:54 -07:00
parent 5a12dd9a21
commit 233da5c650
5 changed files with 17 additions and 15 deletions

12
package-lock.json generated
View File

@@ -8862,9 +8862,9 @@
}
},
"node_modules/minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
},
"node_modules/mkdirp": {
"version": "0.5.5",
@@ -21876,9 +21876,9 @@
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
},
"mkdirp": {
"version": "0.5.5",

View File

@@ -106,7 +106,7 @@ export default class ApiService extends Service {
break;
case "LS_TOGGLE_IMPORT_QUEUE":
console.log("lol")
await this.broker.call("queue.toggleImportQueue", action.data, {});
await this.broker.call("importqueue.toggleImportQueue", action.data, {});
break;
}
});
@@ -148,7 +148,7 @@ export default class ApiService extends Service {
await broker.call("library.walkFolders", {
basePathToWalk: path,
});
await this.broker.call("queue.processImport", {
await this.broker.call("importqueue.processImport", {
fileObject: {
filePath: walkedFolder[0].filePath,
fileSize: walkedFolder[0].fileSize,

View File

@@ -129,7 +129,7 @@ export default class ImportService extends Service {
});
if (!comicExists) {
// 2. Send the extraction job to the queue
await broker.call("queue.processImport", {
await broker.call("importqueue.processImport", {
fileObject: {
filePath: item.path,
fileSize: item.stats.size,

View File

@@ -33,7 +33,6 @@ SOFTWARE.
"use strict";
import { extend, isNil, isUndefined } from "lodash";
import {
Context,
Service,
@@ -55,10 +54,13 @@ const REDIS_URI = process.env.REDIS_URI || `redis://localhost:6379`;
console.log(`REDIS -> ${REDIS_URI}`);
export default class QueueService extends Service {
public constructor(public broker: ServiceBroker) {
public constructor(
public broker: ServiceBroker,
schema: ServiceSchema<{}> = { name: "importqueue" }
) {
super(broker);
this.parseServiceSchema({
name: "queue",
name: "importqueue",
mixins: [BullMQMixin(REDIS_URI), DbMixin("comics", Comic)],
settings: {},
hooks: {},

View File

@@ -4838,9 +4838,9 @@
"brace-expansion" "^1.1.7"
"minimist@^1.2.0", "minimist@^1.2.3", "minimist@^1.2.5":
"integrity" "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
"resolved" "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz"
"version" "1.2.5"
"integrity" "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
"resolved" "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz"
"version" "1.2.6"
"minipass-collect@^1.0.2":
"version" "1.0.2"