✏️ 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

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: {},